[antlr-interest] Re: antlr vs. javacc+jjtree tree construction
parrt at jguru.com
Wed Mar 27 20:08:27 PST 2002
I just added your comments to my FAQ entry:
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/
More information about the antlr-interest