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

Robert Enyedi renyedi at yahoo.com
Thu Mar 28 00:30:51 PST 2002


Hi Terence and Loring,

Thank you very much for your responses. Very useful ones.

I agree with you regarding the differences between parse trees and ASTs. I
didn't think about it until now, but indeed there are some fundamental
differences. I already reconsidered my current AST generation pattern and
managed to simplify it (and more to come).

And I think the FAQ is a well suited place for this issue.

Thanks again,
Robert

----- Original Message -----
From: "Terence Parr" <parrt at jguru.com>
To: <antlr-interest at yahoogroups.com>
Sent: Thursday, March 28, 2002 6:08 AM
Subject: Re: [antlr-interest] Re: antlr vs. javacc+jjtree tree construction


> Hi Loring,
>
> I just added your comments to my FAQ entry:
>
> http://www.jguru.com/faq/view.jsp?EID=814505
>
> Ter
>
> On Wednesday, March 27, 2002, at 03:29  PM, lgcraymer wrote:
>
> > ANTLR's annotation approach for constructing trees is much nicer than
> > the conventional approach--nonterminals represent language features
> > (like "if" for conditional statement blocks) rather than the grammar
> > writer's view of the language.  Why should
> >
> > foo :  A B C bar ;
> > bar : D E F ;
> >
> > generate a different tree than
> >
> > foobar : A B C D E F ;
> >
> > by default?
> >
> > Worse:  it is possible to generate both trees in one grammar.
> > Recognizing that a #( foo A B C #(bar D E F) ) tree is the same as
> > #( foobar A B C D E F ) is just an added burden to the programmer.
> >
> > With ANTLR, "C" can be identified as an important feature for decoding
> > "A B" and "D E F" semantics via the structuring
> >
> > foobar :  A B^ C^ D E F ;
> >
> > which results in a tree matched by
> >
> > tfoo : #( C #( B A ) D E F ) ;
> >
> > that effectively distinguishes C (root), B A (B as first child of C, A
> > as a child of B), and D E F (other children).
> >
> > Because ANTLR matches trees from the top down, the "rule identifier"
> > nodes are unnecessary--they can be considered implicit in the tree
> > walker rules.  Also, ANTLR trees can be manipulated from one language
> > structure to another--tree transformation is a very clean approach for
> > language translation.
> --
> Chief Scientist & Co-founder, http://www.jguru.com
> Creator, ANTLR Parser Generator: http://www.antlr.org
>
>
>
>
> 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/ 



More information about the antlr-interest mailing list