source: CIVL/mods/dev.civl.abc/grammar/c/Simple.g

main
Last change on this file was aad342c, checked in by Stephen Siegel <siegel@…>, 3 years ago

Performing huge refactor to incorporate ABC, GMC, and SARL into CIVL repo and use Java modules.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5664 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 446 bytes
Line 
1grammar Simple;
2
3options {output=AST;}
4
5tokens{
6 IF;
7 BAR;
8}
9
10start : foo{System.out.println($foo.tree);}
11 ;
12
13foo : b=bar WS* -> ^(IF {new CommonTree((CommonTree)((CommonTree)$b.tree).getChild(1))} {new CommonTree((CommonTree)((CommonTree)$b.tree).getChild(0))});
14
15bar : ID WS+ INT -> ID INT;
16
17//foo : bar WS* -> ^(IF bar);
18//bar : ID WS+ ID -> ID ID ;
19INT : '0'..'9'+ ;
20ID : ('a'..'z'|'A'..'Z')+ ;
21NEWLINE:'\r'? '\n' ;
22WS : (' '|'\t')+ ;
Note: See TracBrowser for help on using the repository browser.