On Sat, 2008-10-25 at 11:57 +0200, Simon wrote:
> Is it so obvious? Or is it simply not possible to achieve the same
> thing using rewrite rules?
Have you tried a few things yourself? It won't explode if you do it
wrong :-)
Try things akin to:
e
: p -> $p
(
a='.' i=id
->^($a $e $i) // Or $a $i $e
)*
;
Jim
>
> On Oct 22, 2008, at 3:07 PM, [EMAIL PROTECTED] wrote:
>
> > 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
> >
> > List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
> > Unsubscribe:
> > http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
>
>
> List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address