I have problem running input stream for my grammar, here is part of my grammar
expression
: ....
| ( '+' | '-' | '&' |) expression
| expression ('+'|'-') expression
....
;
when input stream like 2+2-2 or (2+2+2)-2, error occurs
line 10:30 extraneous input '-2' expecting {',', '^',...}
why my grammar can not distinguish between -2 and 2-2 ? anyone help me please !