1
I have a grammar:
grammar SimpleCalc;
expr : term ( ( '+' | '-' ) term )* ';' ;
term : number ;
number : DIGIT+ ;
DIGIT : '0'..'9' ;
WHITESPACE : ( '\t' | ' ' | '\r' | '\n'| '\u000C' )+ -> channel(HIDDEN);
Exit:
Parse Tree:
expr (
term (
number (
"3"
)
)
"+"
term (
number (
"2"
)
)
";"
)
To add multiplication and division, would just do that?
expr : term ( ( '+' | '-' ) term )* ';' ;
I’m a little lost, if you have some doc to help me would be great