[antlr-interest] brief analysis of java.g's tree building in
2.x vs proposed 3.0
Monty Zukowski
monty at codetransform.com
Tue Feb 1 05:58:24 PST 2005
Dean Tribble wrote:
> Terence Parr wrote:
>
>
>>The real test of any proposal is to see what it looks like in
>>practice. I have looked again at the java grammar. Here is some useful
>>info.
>
>
> For another antlr grammar, please check out:
>
> http://www.erights.org/e-impls/e-on-e/egrammar/
>
> which includes the grammar for the E language (and its two lexers). The
> grammar is still under development (e.g., not all productions make the
> right trees), but I spent a lot of time trying to figure out how to make
> trees (e.g., for left and right associativity). I like the idea of
> improving the tree construction support. I've tried very hard in the
> grammars to stay within the antlr-only syntax, and avoid using Java
> action code. Any cleanup so that the grammar is more obvious (and so
> that the grammar is not shaped by the needs of tree construction) would
> be excellent.
With 2.7.x it is hard to avoid modifying the grammar for the sake of the
trees. Do you have any other than an aesthetic reason for doing so?
Note that you've already modified your grammar from a higher level EBNF
to deal with the practical problems of LL parsing, like disambiguation.
For most all of my projects the crucial element has been the tree
structure, which needs to be designed with the transformation tasks in
mind. All of my interesting work is based on the tree structure, not
the grammar. With 2.8, (and I assume 3.0), the tree structures flow
more gracefully from the grammar. 2.7 isn't quite as friendly.
Do you already have tree structures dictated by your compiler? Or is
this an exercise in learning how it would be done the ANTLR way?
Monty
More information about the antlr-interest
mailing list