bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Identifying rule responsible for lookahead


From: Soumitra Kumar
Subject: Identifying rule responsible for lookahead
Date: Mon, 28 Mar 2005 21:58:59 -0800 (PST)

I had started this thread on help-bison list
previously.
Basically I wanted bison to print the rules no
responsible for a lookahead symbol. So that fixing the
rule is easier. Otherwise for a big size grammar it is
time consuming to find the culprit rules. I managed to
hack bison code to produce what I wanted. My bison
writes a file "sonu.dbg". This file with .output file
should be used to get the list of rules.

Sample run:
$ cat err.y
%token YYID YYDOT
%%
identifier : hier_id
        ;
hier_id : simple_id
        | hier_id opt_select YYDOT simple_id
        ;
opt_select : | opt_select '[' expr ']'
        ;
simple_id : YYID
        ;
expr : hier_id
        | function_call
        ;
function_call : expr YYDOT YYID
        ;
$ cat sonu.dbg
Adding LA <0> to <1> to state <3>.
Adding LA <2> to <3> to state <10>.
**** DUMPING Final LA with rules ****
0: set = {0 ($end) [0]}
1: set = {4 (YYDOT) [3], 5 ('[') [5]}
2: set = {4 (YYDOT) [3], 5 ('[') [5]}
3: set = {4 (YYDOT) [9], 6 (']') [5]}
**** END DUMPING Final LA with rules ****

Please visit
http://homepage.mac.com/soumitra/MyBison.html for
futher info and link to hacked bison code.
-Soumitra.



                
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]