[antlr-interest] tree parser example PDF docs and ANTLR Patterns (was Re: the tree parser exampl)
lgcraymer
lgc at mail1.jpl.nasa.gov
Tue May 7 14:08:35 PDT 2002
--- In antlr-interest at y..., "jsrs701" <jsrs701 at y...> wrote:
> Speaking of medium-sized ANTLR projects, has anyone else thought
> about putting together an ANTLR Patterns collection? A few that I'm
I think that your idea is good, but not quite on target. I think that
the items you mention tend to have to do with grammar structuring
(a catalog of refactoring principles would be useful), rewriting, and
interfacing to backend processors. These are all worthy topics. Some
specifics follow.
> thinking about, to whit:
>
> * Expression parsers with precedence
This is a tree structuring issue, and the principle is "structure your
grammar so that the syntax trees reflect operator precedence". The
Calc examples demonstrate this.
> * Successively applied tree parsers for optimization/transformation
> sequences
This is on applying rewrite rules for grammar transformation. There
has been quite a bit of research on rewriting, and it would be
interesting to interface the BURG (bottom up rewrite
generator)algorithm with ANTLR to do the "match pattern and rewrite"
approach to rule and tree transformation (as opposed to ANTLR's match
rule and rewrite according to user annotations).
BTW, I just received a letter that okays release of my rewriting
support and tree grammar generation extensions under copyright. Now I
have to find out what else I need to do to actually release it, but I
can hope for an early June release. This is probably a good starting
point for incorporating meta-level rewrite rules--the extensions
generate a syntax tree for the output grammar from an input grammar.
> * Text scanners (like Ter's "really big lookahead" article) vs...
> * Compilers
This is a matter of interfacing to a backend. An interesting start in
this direction would be for someone to generate RTL from a transformed
ANTLR syntax tree. Monty's GNU C grammar is much cleaner than the GNU
C flex/bison (at least the gcc front end used to be a case of "abandon
hope all ye who enter here"--I haven't looked at the source since a
1.xx release) and an ANTLR C++ front end would be a major improvement.
> * Interpreters
I don't know of an interpreter written in ANTLR, although Ter has
provided a few hooks for the purpose. It would be interesting to hear
of any experiences with ANTLR in this area.
>
> What do people think?
>
> JSRS
--Loring Craymer
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list