[antlr-interest] ANTLR 3.0ea3 released
Terence Parr
parrt at cs.usfca.edu
Thu Jun 23 13:28:14 PDT 2005
On Jun 23, 2005, at 12:18 PM, Gerald B. Rosenberg wrote:
> ANTLR 2.7.5/2.7.6
>
> One thing that I continue to have problems with is the need to walk
> up trees. Cannot seem to find a getParent() method or a working
> example of how (best) to add this functionality to an ASTNode
> override? Without an existing getParent, I cannot see a clean way
> to provide backlinks in newly created ASTNodes overrides. Have I
> missed something?
One way to handle this (at least I've tried it years ago) is to call
a method to link everything up doubly *after* the tree has been
built. I found that the integrity/validity of double-linked trees is
very complicated to keep together. :(
I also found that the need to "look up" is the same as needing to
obtain context information, which usually can be provided via the
grammar and a few variables.
> Also, are the auto-trees in 3.0 doubly linked?
Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
More information about the antlr-interest
mailing list