[antlr-interest] Tree Operators vs. Tree Rewrite Rules
cocoa at gmx.ch
cocoa at gmx.ch
Wed Oct 22 06:07:10 PDT 2008
Hi
I try to build an AST for the following sentences:
a.b.c;
or
a.b.c.d.e;
The grammar is shown below. The expected tree (for the first example) is
^('.' ^('.' 'a' 'b') 'c')
It works as expected with tree operators:
prog
: expr ';'!
;
expr
: primary ('.'^ ID )*
;
primary
: ID
;
However, I can't get the same tree using tree rewrite rules. Is it possible at all? If so, could somebody please show me how?
Thanks
Simon
PS: ultimately, I want to build an AST for a Java like language (method calls, field access, ...)
--
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196
More information about the antlr-interest
mailing list