You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given that the unary minus has higher precedence than the infix minus, there should be no conflict: There should be a reduce on the last production in the item set. So it seems that precedence declarations are ignored when resolving reduce/reduce conflicts.
Peter Sestoft tells me that he resolved this issue in mosmlyac (which is also based on ocamlyacc), as well as an isse with %nonassoc, around 10 years ago.
The text was updated successfully, but these errors were encountered:
Consider this grammar file:
%token ONE MINUS MIN
%left MINUS
%right UMINUS
%right MIN
%start Exp
%type Exp
%%
Exp:
ONE { 1 }
| Exp MINUS Exp { $1 - $3) }
| MINUS Exp %prec UMINUS { - $2 }
| MIN Exp Exp { min $2 $3 }
;
%%
With mosmlyac, this generates no conflict, but with fsyacc, it generates three reduce/reduce conflicts:
state 4: reduce/reduce error on ONE
state 4: reduce/reduce error on MINUS
state 4: reduce/reduce error on MIN
State 4 has the following items:
Given that the unary minus has higher precedence than the infix minus, there should be no conflict: There should be a reduce on the last production in the item set. So it seems that precedence declarations are ignored when resolving reduce/reduce conflicts.
Peter Sestoft tells me that he resolved this issue in mosmlyac (which is also based on ocamlyacc), as well as an isse with %nonassoc, around 10 years ago.
The text was updated successfully, but these errors were encountered: