[antlr-interest] Tree Construction - DOT operator
Adrian Sanchez
eyboy.sanchez at yahoo.com
Thu Feb 7 22:19:51 PST 2008
Hi guys,
I’m just new to Antlr (just started studying it last week)
and I want to ask for your help. I’m trying to learn about tree construction/tree
parsing and was stumped with this problem.
See, I’m trying to create an AST from the following rules
(this is based on the Python grammar in the antlr site):
primary : atom (trailer)*;
trailer : '.' ID //e.g. Rect1.Width”;
args : ID (',' ID)*;
I was wondering how I could represent the AST for
primary. I was thinking of something like:
1.
-> atom
//if
there is no trailer
2.
-> ^(GETMEMBER atom ID) //if
there is a trailer
This sounds like a pretty simple and common scenario so I’m
sure you guys can help. Thanks.
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080207/3be11ca3/attachment-0001.html
More information about the antlr-interest
mailing list