1 /* This is test.g which tests simple AST refs and construction */
4 typedef ANTLRCommonToken ANTLRToken;
8 class AST : public ASTBase {
11 AST(ANTLRTokenPtr t) { token = t; }
12 void preorder_action() {
13 char *s = token->getText();
20 ParserBlackBox<DLGLexer, Expr, ANTLRToken> p(stdin);
30 #token "[\ \t\n]+" <<skip();>>
33 class Expr { /* Define a grammar class */
35 e : mult_expr ( ("\+"^|"\-"^) mult_expr )*
39 : atom ( ("\*"^|"\/"^) atom )*
48 #token IDENTIFIER "[a-z]+"
49 #token NUMBER "[0-9]+"