[antlr-interest] antlr vs. javacc+jjtree tree construction

Robert Enyedi renyedi at yahoo.com
Wed Mar 27 03:24:41 PST 2002


Hi, everyone

I have worked previously with JavaCC and I used JJTree to build syntax trees. By default, it creates a root node for each grammar rule (identified by the constant JJT<RULENAME>) and attaches to it as child nodes the nodes that come from its sub rules.

When I got to use buildAST in ANTLR for the first time, I noticed a fundamental difference: by default it creates a list of token nodes. It is true that if I want the same behavior as in JavaCC, I can use the action {#ruleName=#([NODE_TYPE_NAME],#ruleName);} and define NODE_TYPE_NAME in the tokens section.

But why do I have to do this manually? Isn't there a workaround to automate this task? And, somehow, isn't JJTree's behavior the natural one?

I would really like to discuss this issue with you, guys.

Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20020327/a8416e14/attachment.html


More information about the antlr-interest mailing list