[antlr-interest] antlr vs. javacc+jjtree tree construction
Chuck Siska
chuck.siska at nb.conexant.com
Wed Mar 27 09:22:36 PST 2002
robert --
if you want, you can create a fake token for each such rule and then
use the "^" to make it the root of each grammar rule. this is
normally done rather sparingly, but if you like it, enjoy.
-- chuck
Robert Enyedi wrote:
>
> Yes, but as far as I know you can apply the '^' operator to a token. So what
> if the rule has no tokens?
>
> ----- Original Message -----
> From: "Bogdan Mitu" <bogdan_mt at yahoo.com>
> To: <antlr-interest at yahoogroups.com>
> Sent: Wednesday, March 27, 2002 1:47 PM
> Subject: Re: [antlr-interest] antlr vs. javacc+jjtree tree construction
>
> > 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/
> >
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
--
|\_/\_.-'""``:-._
What is life without looking for . . `; -._ )-;-,_`)
the next cute little bug to play with? v_,- _ ),(,.\ ``-'
_.- _.,-_/ / ((.'
-- chuck.siska at conexant.com `<}:.. ((,.-' ((,/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list