[antlr-interest] [v3] TreeParser capabilities

Emond Papegaaij e.papegaaij at student.utwente.nl
Tue Nov 14 05:32:24 PST 2006


Hello,

For a research project I need some information about the capabilities of the 
TreeParser (for ANTLR v3). My application uses a custom TreeAdaptor, which 
constructs trees in a very different maner. The tree classes do not extend 
CommonTree, nor do they implement Tree.

My first question: Is it possible to use a TreeParser with these nodes? It 
seems the TreeParser is based on a NodeStream, which presents the tree nodes 
to the TreeParser one by one. However only an implementation based on 
CommonTree is provided. What is needed to use a TreeParser with my custom 
TreeAdaptor? Do I need to write a TreeNodeStream based on a TreeAdaptor, or 
is such a stream already available?

My second question: Is it possible to skip sub-trees, or visit the same branch 
more than once (for example in an interpreter of a for statement)? I suspect 
that the NodeStream will get out-of-sync when you try to do so.

Best regards,
Emond Papegaaij


More information about the antlr-interest mailing list