[antlr-interest] Grammar inheritance?
Terence Parr
parrt at cs.usfca.edu
Wed Oct 4 10:11:00 PDT 2006
On Oct 4, 2006, at 7:17 AM, Hill, Robert wrote:
> Does this work in 3.0b4?
> Im trying to create a base class using the grammar option
> { superClass=baseGrammar; }
That is for specifying the Java class to drive from not the grammar.
> But for the derived grammar file its generating 'null.java' which
> contains about 20 lines of code :(
>
> If it is working how do I create a subclass of a base grammer?
Currently there is no way. A way to do so will appear in a future,
just after the first real release. There are a number of important
players that want this and I have some good ideas about how to make
it better than the mechanism in ANTLR 2. for example, I expect that
the generated code for sub grammars will inherit not include rules
from the super grammar. This will significantly reduce code float
found in the current version. I would like to spend some time
thinking about the correct model before we jump.
Ter
More information about the antlr-interest
mailing list