[antlr-interest] ... and ANTLR Patterns

Terence Parr parrt at jguru.com
Thu May 9 10:34:54 PDT 2002


On Wednesday, May 8, 2002, at 09:44  AM, Ruslan Zasukhin wrote:
> 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?

Both.  By overriding you can change the lookahead of other rules.

> In the first case you can PROHIBIT overridden.

What's the point of subclassing if you can't override? ;)

> In the second you can try resolve task sending lookahead sets as 
> parameter.

That is not always possible because I often encode sets in raw java like 
LA(1)==IDENT for efficiency.  You are suggesting a more interpreted 
model which would easily work, but would be slower.

>> 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.

Unless you are deploying on a small device, it can't possibly matter if 
I replicate some code, can it?

Ter
> --
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org


 

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



More information about the antlr-interest mailing list