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

Bogdan Mitu bogdan_mt at yahoo.com
Wed Mar 27 03:47:17 PST 2002


Hi Robert,

In ANTLR you normally use the '^' operator to direct the AST construction.
Sometimes you need to add manually some nodes, but most of the time '^' and
'!' do the job.

Regards,
Bogdan

--- Robert Enyedi <renyedi at yahoo.com> wrote:
> 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
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list