I currently have an error in my Bison with regards to my EBNF while creating the parsing for PEMDAS and conditions. I don't understand well on how I'm going to reduce the EBNF.
I got 1 shift/reduce error in the output file. Here's the part where the conflicting appears. The "expr" in "rel_cond" appears to be in conflict when I declared the "rel_expr" and "par_expr" rules.
cond : rel_cond
| par_cond
;
rel_cond : expr relop cond
| expr
;
par_cond : PAR_START cond PAR_END
;
.
.
expr : rel_expr
| par_expr
;
par_expr : PAR_START expr PAR_END
;
rel_expr : term ADD expr
| term SUB expr
| term
;
term : factor MULT factor
| factor DIV factor
| factor
;
factor : CONSTANT
| ID
;
Here's what appears in the .output file
state 47
16 rel_cond: expr . relop expr
17 | expr .
32 par_expr: PAR_START expr . PAR_END
EQT shift, and go to state 49
NOT_EQT shift, and go to state 50
LT shift, and go to state 51
GT shift, and go to state 52
LT_EQT shift, and go to state 53
GT_EQT shift, and go to state 54
BIT_AND shift, and go to state 55
LOG_AND shift, and go to state 56
BIT_OR shift, and go to state 57
LOG_OR shift, and go to state 58
PAR_END shift, and go to state 41
PAR_END [reduce using rule 17 (rel_cond)]
relop go to state 59