[antlr-interest] What about grammar inheritance?

Silvain Piree s.piree at enneya.com
Tue Dec 16 03:07:13 PST 2003


> > Will there be an alternative grammar re-use mechanism
> > in ANTLR 3?
> Either inheritance or delegation or something...haven't turned my 
> thoughts to this yet. :)

How about a simple include mechanism instead of inheritance.
That's in essence what the current inheritance mechanism does.

A simple include directive allows you to include common 
grammar rules. That would solve most of my problems
(especially if it also works for class methods).

It would also be nice if it were possible to extend previously 
defined grammar rules, i.e. adding additional subrules.

For example:

    statement    :   "ASSIGN" | "MOVE" ;
    statement + : "LET" | "GOTO" ;

That way it would be possible to define common grammar parts
in include files, and extend these grammar rules in a specific 



Yahoo! Groups Links

To visit your group on the web, go to:

To unsubscribe from this group, send an email to:
 antlr-interest-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to:

More information about the antlr-interest mailing list