[antlr-interest] [v3] TreeParser capabilities

Kay Roepke kroepke at classdump.org
Mon Nov 20 03:07:47 PST 2006


On 20. Nov 2006, at 11:57 , Emond Papegaaij wrote:

> I'm using a heterogeneous AST, which is generated by an external  
> tool. This
> tree is strictly typed, with fields containing the various  
> subtrees. This
> makes the Tree interface difficult to implement. All functionality  
> required
> for the Tree interface is already part of the custom TreeAdaptor  
> (such as
> getChildCount() and getChild(int)). Therefore, I'm wondering why the
> CommonTreeNodeStream is based on the Tree interface, and not on a
> TreeAdaptor. Especially because CommonTreeNodeStream can take a  
> TreeAdaptor
> in its constructor, but it's not used.

Ah, I see. I think the reason was to not place any burden on the tree  
nodes, i.e.
you should be able to pass in everything, as long as it implements  
the basic Tree
interface. At some point Terence has said that he wants to support  
heterogeneous
trees again. It's just not done yet :(
You can probably hack around for the time being, it all depends on  
how much custom
code you are willing to invest at this point.

>> ANTLR cannot skip subtrees currently :( It's a pain, but it's not
>> there yet, sorry.
>
> Is this a planned feature?

Definitely, but again, I can't say when that'll be, with the book and  
bugs and all.

cheers,
-k
-- 
Kay Röpke
http://classdump.org/






More information about the antlr-interest mailing list