The problems are in your expr
and term
rules.
In
expr
, you try to assign$exprP.i
instead of just passing an argument. It should look like the following.expr returns [int val] : term exprP[$term.val] { $val = $exprP.val; } ;
In
expr
, you try to assign$termP.i
instead of just passing an argument. It should look like the following.term returns [int val] : fact termP[$fact.val] { $val = $termpP.val; } ;
I thought newer versions of ANTLR 3 (3.5.2 is the most recent) did a better job providing line and column numbers for these errors, but that may be a feature that's new to ANTLR 4.