6 class ExprParser extends Parser;
8 expr returns [int value=0]
11 ( PLUS x=mexpr {value += x;}
12 | MINUS x=mexpr {value -= x;}
16 mexpr returns [int value=0]
18 : value=atom ( STAR x=atom {value *= x;} )*
21 atom returns [int value=0]
22 : i:INT {value=Integer.parseInt(i.getText());}
23 | LPAREN value=expr RPAREN
30 class ExprLexer extends Lexer;
32 k=2; // needed for newline junk
33 charVocabulary='\u0000'..'\u007F'; // allow ascii
47 {$setType(Token.SKIP);}