Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- grammar Expr;
- // Need to call recursive rule expr from non-recursive rule
- r : expr+ ;
- // ANTLR4 : Left recursion!
- // Operator precedence matches order of definition
- expr : '-' expr // Unary minus
- | expr ('*' | '/' ) expr
- | expr ('+' | '-' ) expr
- | '(' expr ')'
- | INT
- | ID
- ;
- INT : [0-9]+ ;
- ID : [a-z]+ ;
- WS : [ \t\r\n]+ -> skip;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement