[antlr-interest] change to AST construction operators
Terence Parr
parrt at cs.usfca.edu
Mon Dec 18 09:37:01 PST 2006
Howdy,
While writing the chapter on AST construction in the book, I realize
I have made a mistake. I have created both ^^ and ^ operators where
^^ is the new version of v2's ^ operator. I created two different
versions so that you could set the root of the entire tree and the
root of the enclosing subtree using different operators. This would
have been very useful in v2, but I realize now that the rewrite rules
are a much better way to specify trees that would require subrule
tree roots. I am going to remove ^^ and make the semantics of ^ the
same as they were in v2: set the root of the current rule's tree.
This has the added benefit of significantly reducing the complexity
of the code generation for the automatic tree construction and AST
operators. It will also make it faster and use less memory. good
benefits all around.
Target developers: sorry for the change near the end, but I want to
create what is correct and the book is helping me do a lot of
thinking about the semantics of the ANTLR metalanguage. Fortunately,
the change will be to simply remove some templates and/or slightly
alter some existing templates... so the change should be minimal. I
will make sure that ANTLR itself tweaks the operator etc. I hope to
have these changes done in the next couple of days as I finish up the
tree chapter.
Ter
More information about the antlr-interest
mailing list