[antlr-interest] What about grammar inheritance?

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Dec 8 00:58:50 PST 2003


on 12/8/03 10:03 AM, Silvain Piree at s.piree at enneya.com wrote:

> On the antlr website, the paper "ANTLR 3 Whitepaper"
> mentions "dropping inheritance" as one of the features of
> ANTLR 3.
> 
> Will there be an alternative grammar re-use mechanism
> in ANTLR 3?
> 
> We use grammar inheritance extensively to model differences
> in language dialects (e.g. different Cobol dialects, etc.). This
> is a feature I would not like to lose. In fact, it was one of the
> reasons for us to go with ANTLR.

I can add, that I was disappointed with the way grammar inheritance made...

For example, we have SQL parser for our Valentina database.
This parser include of course EXPRESSION parsing part.

But in Database we have also part, where we need ONLY EXPR part.

When I have read docs of ANTLR I did expect that if I make grammars

    EXPR 
    SQL : inherited from EXPR


Then I will get 2 C++ classes

    EXPR
    {
    }

    SQL : EXPR
    {

    }

But in second case I get just class SQL with all the same methods.
This is NOT GOOD.

For now I did go just with one SQL class, and simply use as entry point
expr() method. This works well, and no overhead not by code size not by
performance     


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------


 

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




More information about the antlr-interest mailing list