[antlr-interest] super grammar surprise

Bryan Ewbank ewbank at gmail.com
Wed May 25 16:57:47 PDT 2005


Trust in the #include to preserve behaviors...

class MyBlurfl extends MyParser
{
#include "commoncruft.foo"
}

T'would be nice if there were either true class inheritance, or
multiple inheritance to capture non-production behaviors.


On 5/25/05, Lloyd Dupont <lloyd at nova-mind.com> wrote:
>  
> mmhh... I guess it's a feature, as it let you 'override' the declared code. 
> well I have to copy paste I suppose.... 
>   
> BTW if I don't declare any class code in my subgrammar the supergrammar
> class code is used, sweet ;)
>  
>  
> ----- Original Message ----- 
> From: Lloyd Dupont 
> To: antlr-interest at antlr.org 
> Sent: Thursday, May 26, 2005 9:24 AM 
> Subject: [antlr-interest] super grammar surprise 
> 
>  
> I'm writting a subgrammar of the GNU-C grammar. 
> I don't know if my problem is due to a 4 level inheritance (Parser ->
> StdCParser -> GnuCParser -> ObjectiveCParser) but anyway, I had the surprise
> that the class code (as in: 
>     class MyParser extends Parser;
>     { 
>         // class code 
>     } 
>     idList : ( ID )+;   // parser rule definition
> ) is not passed on the subclass?! 
> Is it a bug or a feature?


More information about the antlr-interest mailing list