antlr/tool/playground/T.g

8 lines
163 B
Plaintext
Raw Normal View History

grammar T;
2012-07-27 08:28:10 +08:00
s : stmt EOF ;
stmt : ifStmt | ID;
ifStmt : 'if' ID stmt ('else' stmt | {_input.LA(1) != ELSE}?);
ELSE : 'else';
ID : [a-zA-Z]+;
WS : [ \n\t]+ -> skip;