[antlr-interest] ANTLR v3 Tree Interface request

Terence Parr parrt at cs.usfca.edu
Mon Apr 3 15:09:50 PDT 2006


On Apr 3, 2006, at 2:37 PM, Oliver Wong wrote:

> 	Not sure if this is the right place to discuss this, but I'd
> like to request a change to the org.antlr.runtime.tree.Tree interface
> before ANTLR v3 is officially released.

They are very open to discussion. :)

I see is implemented in BaseTree and CommonTreeAdaptor.

> 	One of the methods defined in the Tree interface is dupNode().
> I'm guessing that the intended behaviour of this method is to  
> duplicate
> "this" node only, and not to recursively duplicate the children.
> However, this is very inconvenient for me, because my Tree
> implementation uses parent-pointers, and if I dupe a node, without
> duping its children, then the child would either need to support
> pointing to multiple parents, or have its parent-reference be
> inconsistent.

Interesting problem...

> 	I've looked around at all the usages of dupNode(), and it seems
> its always used as part of a recursive descent to duplicate the whole
> tree. Is it possible to remove this method from the Tree interface?  
> You
> can just have it as an abstract method on
> org.antlr.runtime.tree.BaseTree,

you're right...

> which looks like the only place that
> method is used.

Seems like we should open up the whole interface to discussion...

Ter


More information about the antlr-interest mailing list