Resolving shift/reduce conflict in Bison grammar

2010-07-31 Thread anandvn
Hi, Could any one please help me in resolving the shift/reduce in the following grammar? %{ #include extern char yytext[]; extern int column; void yyerror(char const *s); %} %union { unsigned int tokVal; unsigned char *tokValStr; } /* C operators */ %token STATIC CONST VOLATI

Re: Resolving shift/reduce conflict in Bison grammar

2010-07-31 Thread Hans Aberg
On 31 Jul 2010, at 15:54, anandvn wrote: Could any one please help me in resolving the shift/reduce in the following grammar? Have you tried applying precedences on the tokens immediately before and after the "." in the conflicting states (as in the .output file)? Hans _

Re: Resolving shift/reduce conflict in Bison grammar

2010-07-31 Thread Panayiotis Karabassis
Hi! Use the -v (verbose) flag on bison to generate the xxx.output file that contains more information about the parser automaton (including where the conflicts appear). Then please post it here. You may also want to read the debugging section from: info bison Regards, Panayiotis On 07/

Re: Resolving shift/reduce conflict in Bison grammar

2010-07-31 Thread Martin Alexander David Neumann
Hi Anand, the problem is in your productions of "external_declaration". Informally: Imagine the shift-reduce parser generated by bison sees one of the following terminals as the next symbol in the input: STATIC, CONST, VOLATILE, EXTERN, INT or UNSIGNED. The parser now can reduce the init_dec rule,

Re: Resolving shift/reduce conflict in Bison grammar

2010-07-31 Thread anandvn
Hi, find the output file info below, State 0 contains 6 shift/reduce conflicts. State 7 contains 6 shift/reduce conflicts. state 0 STATIC shift, and go to state 1 CONST shift, and go to state 2 VOLATILEshift, and go to state 3 EXTERN shift, and go to state 4

Re: Resolving shift/reduce conflict in Bison grammar

2010-07-31 Thread Martin Alexander David Neumann
Hi Anand, as I already mentioned, the problem is in your productions of "external_declaration": external_declaration : function_definition | declaration ; probably the bext fix is to get rid of your init_dec non-terminal or you change the above to something like: externa