parser grammar ACalcParser;
options { tokenVocab = ACalcLexer; }
prog
: stmt prog # Program
| EOF # EmptyProg
;
stmt : exp STOP ;
exp
: exp OPA term # AddSub
| term # SingleTerm
;
term
: term OPM factor # MulDiv
| factor # SingleFactor
;
factor
: NUM # Num
| LP exp RP # Parens
;