Rohit Bajaj
asked on
Removing shift/reduce warnings in Bison Parser
HI,
I am getting the following warning on building the grammar file using bison :
How can i get rid of this warning ? Although its just a warning dont know if it will have any consequence.
I have posted another question on the same code here :
https://www.experts-exchange.com/questions/29200170/Parser-not-showing-all-errors.html#questionAdd
So all the files can be get from this. Its all ready just execute make thats all..
Need some expert comments on this .
Thanks
I am getting the following warning on building the grammar file using bison :
How can i get rid of this warning ? Although its just a warning dont know if it will have any consequence.
I have posted another question on the same code here :
https://www.experts-exchange.com/questions/29200170/Parser-not-showing-all-errors.html#questionAdd
So all the files can be get from this. Its all ready just execute make thats all..
Need some expert comments on this .
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
parser.output
Hi,
Please find the parser.output file after running make
Added the -rall option
Hi,
Please find the parser.output file after running make
Added the -rall option
make
bison -rall -d -v parser.y
parser.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
mv parser.tab.c parser.c
mv parser.tab.h tokens.h
g++ -c scanner.c
g++ -c parser.c
g++ -o compile scanner.o parser.o listing.o
ASKER
Can this parser.output provide some hints to the behavior happeniing in the other question i posted :
https://www.experts-exchange.com/questions/29200170/Parser-not-showing-all-errors.html#questionAdd
Please point or give some hints into this parser.output file
https://www.experts-exchange.com/questions/29200170/Parser-not-showing-all-errors.html#questionAdd
Please point or give some hints into this parser.output file
[code]
State 6 conflicts: 1 shift/reduce
State 72 conflicts: 1 shift/reduce
State 6
2 function_header: FUNCTION IDENTIFIER . RETURNS type ';'
3 | FUNCTION IDENTIFIER . parameters RETURNS type ';'
7 parameters: . parameter
8 | . parameter ',' parameters
9 | . %empty [RETURNS]
10 parameter: . IDENTIFIER ':' type
IDENTIFIER shift, and go to state 10
RETURNS shift, and go to state 11
RETURNS [reduce using rule 9 (parameters)]
parameters go to state 12
parameter go to state 13
State 72
20 statement: CASE expression IS . when OTHERS ARROW statement_ ENDCASE
21 when: . WHEN INT_LITERAL ARROW expression ';'
22 | . when WHEN INT_LITERAL ARROW expression ';'
23 | . error ';'
24 | . %empty [OTHERS, WHEN]
error shift, and go to state 85
WHEN shift, and go to state 86
OTHERS reduce using rule 24 (when)
WHEN [reduce using rule 24 (when)]
when go to state 87[/code]
Ok the first one in State 6 is that the parser doesnt know if whether to shift and go to st 11 or reduce using rule 9
RETURNS shift, and go to state 11
RETURNS [reduce using rule 9 (parameters)]
the Second one in state 72 cant decide between:
WHEN shift, and go to state 86
or
WHEN [reduce using rule 24 (when)]
This is as far as I can help, what you need to do to fix is out of my comprehension/knowledge.
State 6 conflicts: 1 shift/reduce
State 72 conflicts: 1 shift/reduce
State 6
2 function_header: FUNCTION IDENTIFIER . RETURNS type ';'
3 | FUNCTION IDENTIFIER . parameters RETURNS type ';'
7 parameters: . parameter
8 | . parameter ',' parameters
9 | . %empty [RETURNS]
10 parameter: . IDENTIFIER ':' type
IDENTIFIER shift, and go to state 10
RETURNS shift, and go to state 11
RETURNS [reduce using rule 9 (parameters)]
parameters go to state 12
parameter go to state 13
State 72
20 statement: CASE expression IS . when OTHERS ARROW statement_ ENDCASE
21 when: . WHEN INT_LITERAL ARROW expression ';'
22 | . when WHEN INT_LITERAL ARROW expression ';'
23 | . error ';'
24 | . %empty [OTHERS, WHEN]
error shift, and go to state 85
WHEN shift, and go to state 86
OTHERS reduce using rule 24 (when)
WHEN [reduce using rule 24 (when)]
when go to state 87[/code]
Ok the first one in State 6 is that the parser doesnt know if whether to shift and go to st 11 or reduce using rule 9
RETURNS shift, and go to state 11
RETURNS [reduce using rule 9 (parameters)]
the Second one in state 72 cant decide between:
WHEN shift, and go to state 86
or
WHEN [reduce using rule 24 (when)]
This is as far as I can help, what you need to do to fix is out of my comprehension/knowledge.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
--warnings=none
However, this does in fact turn off all warnings, including ones you want to see.