[antlr-interest] ... and ANTLR Patterns

Ruslan Zasukhin sunshine at public.kherson.ua
Wed May 8 09:44:38 PDT 2002


on 5/8/02 18:39, Terence Parr at parrt at jguru.com wrote:

> On Tuesday, May 7, 2002, at 02:21  PM, Ruslan Zasukhin wrote:
>> If continue this logic...I again want remind to Terr, that I was very
>> disappointed by "inheritance" of ANTLR.
> 
> Ah...the "inheritance is screwed up" guy :)  Howdy.  Long time no chat.

Hi Terr,
 
> I think you'll find by my prior letters in this list that grammar
> inheritance cannot operate exactly like class inheritance...i even made
> a FAQ entry:
> 
> http://www.jguru.com/faq/view.jsp?EID=68255
> 
> So you are bound to be disappointed if you don't realize what is going
> on.  The crux of the problem is that if you, for example, modify what an
> expr is by subclassing then you necessarily modify the lookahead sets
> for a whole bunch of other rules.  I MUST...repeat MUST reproduce this
> rule to have it's altered lookahead sets useful to your subclass.  Rules
> whose sets do not change are also included because I was too busy to
> figure out which had changed ;)

I see your point, but

1) you mean that expr can be overridden in sub-grammar ?
Or you mean that a sub-grammar ALWAYS change lookahed set?

In the first case you can PROHIBIT overridden.
In the second you can try resolve task sending lookahead sets as parameter.

> BTW, inheritance even in java is a fancy word for "include plus
> override", right?  Just because you can see it happen in antlr shouldn't
> bother you at all.
> 
> I trust this is the last we'll hear about this? ;)

:-) I don't know.

I was going to have simple Expr parser, and its subclass -- SQL parser.

Of course I can use single C++ class, and use Expr() as entry point for the
first parser.... 

I just do not like possible repetition of code in case we really have
several subclasses.


-- 
Best regards,
Ruslan Zasukhin

-------------------------
Paradigma.

e-mail: ruslan at paradigmasoft.com
web   : http://www.paradigmasoft.com

To subscribe to the Valentina mail list
send a letter to valentina-on at lists.macserve.net



 

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



More information about the antlr-interest mailing list