Updated ... i know, my grammar is ambiguous but how can I rewrite this grammar to eliminate this ambiguity? ..................
I have a grammar just like this:
Bison file
%left equal nEqual
%left gre less greOrEqual lessOrEqual
%left plus sub
%left DIV mult exp mod
%left not
%left leftB rightB
%%
S :
var "=" A ";"
;
A:
Aexp
|Rexp
;
Aexp :
Num
| leftB Aexp rightB
| Aexp plus Aexp
| Aexp sub Aexp
| Aexp DIV Aexp
| Aexp mult Aexp
;
Rexp :
Aexp
| Rexp gre Rexp
| Rexp less Rexp
| Rexp greOrEqual Rexp
| Rexp lessOrEqual Rexp
| Rexp equal Rexp
| Rexp nEqual Rexp
;
I get 1 shift/reduce and 1 reduce/reduce conflicts doing this, how can I change the grammar to eliminate Conflicts ?