I wrote this grammar:
/* Precedences */
precedence left UMINUS;
precedence left ID;
Expr ::= ID:e
| NUM:e
| Expr:e1 TIMES Expr:e2
| LP Expr:e RP
;
Call ::= ID:id LP ExprComma:args RP ;
When I try to run the parser on this program:
weirdAverage(5)
(the tokens are: id lp num(which is expr) rp)
I get:
Syntax error in line 1 '('
So, I try to remove this:
precedence left ID;
And now I get an error:
[java] Warning : *** Shift/Reduce conflict found in state #16
[java] between Expr ::= ID (*)
[java] and Call ::= ID (*) LP ExprComma RP
[java] under symbol LP
[java] Resolved in favor of shifting.
[java] Warning : *** Shift/Reduce conflict found in state #79
[java] between Expr ::= ID (*)
[java] and Call ::= ID (*) LP ExprComma RP
[java] under symbol LP
[java] Resolved in favor of shifting.
[java] Error : *** More conflicts encountered than expected -- parser generation aborted