forked from jasder/antlr
new T.g
This commit is contained in:
parent
f20cd82920
commit
f73c319e42
|
@ -1,5 +1,12 @@
|
|||
grammar T;
|
||||
options {tokenVocab=A;}
|
||||
s : ID ;
|
||||
ID : 'a'..'z'+ ;
|
||||
WS : (' '|'\n') {skip();} ;
|
||||
s : expr[0] ;
|
||||
|
||||
expr[int _p]
|
||||
: ID
|
||||
( {5 >= $_p}? '*' expr[6]
|
||||
| {4 >= $_p}? '+' expr[5]
|
||||
)*
|
||||
;
|
||||
|
||||
ID : [a-zA-Z]+ ; // match identifiers
|
||||
WS : [ \t\r\n]+ -> skip ; // toss out whitespace
|
||||
|
|
Loading…
Reference in New Issue