android13/external/antlr/runtime/ObjC/Framework/examples/treeparser/Lang.g

23 lines
394 B
Plaintext
Executable File

grammar Lang;
options {
output=AST;
language = ObjC;
ASTLabelType=CommonTree;
}
tokens {DECL;} // an imaginary node
start : decl ;
decl : type ID ';' -> ^(DECL type ID)
;
type : INTTYPE // automatic tree construction builds a node for this rule
| FLOATTYPE
;
INTTYPE : 'int' ;
FLOATTYPE : 'float' ;
ID : 'a'..'z'+ ;
INT : '0'..'9'+ ;
WS : (' '|'\n') {$channel=HIDDEN;} ;