[antlr-interest] Grammar inheritance?
Robert Hill
rob.hill at blueyonder.co.uk
Wed Oct 4 11:38:45 PDT 2006
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Terence Parr
> Sent: 04 October 2006 18:11
> To: ANTLR Interest
> Subject: Re: [antlr-interest] Grammar inheritance?
>
>
> 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.
Ahh, it all becomes clear ;)
> > 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
Ok, no problem. I was going to have a go at generating a base grammer, then
a derived class with fewer rules and manually editing the class decl. yeah
yeah, I know it's a no no editing the generated code..LOL I just want to see
if it would work :)
Cheers Ter.
Rob
More information about the antlr-interest
mailing list