[antlr-interest] Can tree rewriting be done (easily/out-of-the-box) with the current ANTLR 3.x?
Terence Parr
parrt at cs.usfca.edu
Thu Dec 13 10:12:31 PST 2007
Hi Harald,
I apologize for the delay in getting the tree rewriting done. I am
back working on antlr now, well after I grade my final exam, but Kay
Roepke is here for two weeksfrom Hamburg and we will be doing a lot of
hacking.
In the meantime, you can do tree rewriting by returning a new tree
from every rule. Start by including an @after action I think that
makes a duplicate of the incoming tree $rule.start. When you need to
do a rewrite, you will have to probably manually build the new tree
for those productions needing a new tree. Set the return value. Ack,
every reference to a rule will need to build up a new tree based upon
what is returned. This will be very messy and error prone. Hmm...
Ter
More information about the antlr-interest
mailing list