• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1grammar Lang;
2options {
3	output=AST;
4	language = ObjC;
5	ASTLabelType=CommonTree;
6}
7
8tokens {DECL;} // an imaginary node
9
10start : decl ;
11
12decl : type ID ';' -> ^(DECL type ID)
13     ;
14type : INTTYPE  // automatic tree construction builds a node for this rule
15     | FLOATTYPE
16     ;
17
18INTTYPE : 'int' ;
19FLOATTYPE : 'float' ;
20ID : 'a'..'z'+ ;
21INT : '0'..'9'+ ;
22WS : (' '|'\n') {$channel=HIDDEN;} ;
23