[antlr-interest] [v3] TreeParser capabilities

Terence Parr parrt at cs.usfca.edu
Tue Nov 28 17:46:35 PST 2006


On Nov 20, 2006, at 4:31 AM, Emond Papegaaij wrote:

> It seems, it should be fairly easy to convert CommonTreeNodeStream  
> to use
> TreeAdaptor. I just tried a naive attempt to convert the class. It  
> commes
> down to converting 'node.getChild(n)' to 'adaptor.getChild(node,  
> n)'. There
> are however 2 problems: TreeAdaptor is missing a isNil method and  
> the EOF,
> DOWN and UP nodes cannot be made static final. Another minor issue  
> is that
> some methods are not implemented in CommonTreeAdaptor, such as  
> getChild and
> getChildCount. But these methods are trivial to implement.
>
> With these changes, the tree node stream can be implemented without  
> any
> reliance on the Tree interface, just as the parser.

Cool. doesn't seem like it would have the same performance?  Perhaps  
we can adapt it to be completely general. On the other hand, perhaps  
a subclass should be used for the more general case.

Ter


More information about the antlr-interest mailing list