[antlr-interest] Comments and questions on a recent project

mzukowski at yci.com mzukowski at yci.com
Mon Aug 26 08:29:10 PDT 2002


> This reminds me of another issue.  It seems to me (again, I'm probably
> missing something) that the tree grammar stuff makes reuse difficult.
> I imagine the "correct way" to do things is to define a complete tree
> grammar and then extend it for different applications.  In this way,
> you can override some of the rules (only the ones you are interested
> in).  But, don't you have to rewrite the entire rule?  If so, that
> seems like a real pain if you are likely to establish actions for all
> rules because you end up re-typing the whole grammar anyway.  I'm
> comparing this to something like a "visitor" approach where you can
> just write the action and the rule it is associated with.  Am I
> missing something?  Also, it seems like every application considerably
> complicates my Makefile because I have to establish lots of new
> targets for the generated code from each tree grammar.
>  

I assume you are talking about "grammar subclassing" here.  Yes, the
unit of work in a tree grammar is a rule, it's really difficult to
come up with a specification that lets you tell where to insert code
into an existing rule.  Ultimately we will have an editor that
supports such reuse so you can do a smart copy & paste that will warn
you when the superclass grammar has changed and yours hasn't.  I agree
about the Makefile.  I have written a Makefile generator for antlr
(java), but it should be pretty easy to extend for C++.  See
http://www.antlr.org/showcase/tags.tar.gz.

Monty

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list