[antlr-interest] TreeAdaptor design question

Andreas Bartho andreas.bartho at inf.tu-dresden.de
Tue Sep 4 14:22:03 PDT 2007


Hi,

> Why does the method create(Token) return an Object? I'm curious why an
> Object and not a Tree. When you manipulate trees, it seems to cause
> quite a bit of (useless?) casts everywhere...

this is because you might want tree nodes that do not implement ANTLR's 
tree interface. When I made a TreeAdaptor to output XML (DOM) I was 
quite happy that I could work with Objects :)

Andreas


More information about the antlr-interest mailing list