[antlr-interest] Generating AST other than CommonTree
Kay Roepke
kroepke at classdump.org
Tue Jul 31 16:27:46 PDT 2007
On Aug 1, 2007, at 1:20 AM, Joel Shellman wrote:
> I saw some hint that ANTLR can generate a tree of custom objects
> instead of CommonTree by creating a custom TreeAdapter. I have done
> that, but I see that in the generated parser code, it includes
> CommonTree, so I get ClassCastExceptions. Is there some way around
> this?
You must also set the option ASTLabelType at the top of your grammar:
options {
ASTLabelType="YourClassName";
}
otherwise ANTLR won't do the correct thing at code generation time.
HTH,
-k
--
Kay Röpke
http://classdump.org/
More information about the antlr-interest
mailing list