[antlr-interest] heterogeneous trees
Terence Parr
parrt at cs.usfca.edu
Tue Jul 24 22:58:41 PDT 2007
Hi,
I'm interested in hearing people's needs vis-a-vis heterogeneous ASTs
where each node can have a different type rather than all trees
having CommonTree type.
The adaptor.create(tokenType) method can easily switch on tokenType
to create special nodes, but in some cases you might want ID to be
Var and others to be Method. Any other "user stories"? The v2 stuff
let you set overall type for tokenType but I'll leave that to adaptor
this time I think. It also let you set the type per token ref, which
we could allow like this:
method : 'void' ID<Method> '(' args ')' body ;
decl : 'int' ID<Var> ';' ;
etc...
Would that be sufficient? if so, I can get it into 3.1 whenever that
comes out. I have tree building in tree grammars now and a cool
rewrite mode for it.
Ter
More information about the antlr-interest
mailing list