[antlr-interest] Simple grammar with error

Gavin Lambert antlr at mirality.co.nz
Sun Sep 16 13:54:20 PDT 2007


At 00:30 17/09/2007, Johannes Luber wrote:
 >Does this advice go for only ambiguous token names? Or should
 >overloadable operators implicitly be named after the symbol, 
even
 >if they are used in the grammar only in one place?

That's up to you :)  I'm by no means authoritative; I'm just 
offering my opinion on what makes the most sense to me.

 >Isn't OP_ADDRESS[AMP] allowed? Nonetheless this tipp it now on 
my
 >todo list.

Yes, I believe so.  I haven't really played with that particular 
construction much, but it would lead to better error messages etc, 
so it's probably a good idea.

 >> (And also, if you're modelling a C++-like language that 
supports
 >> operator overloading, even BITWISE_AND isn't necessarily a 
good
 >> name, since that's an overridable operator and so might end up 

 >> doing something completely different.)
 >>
 >It is C#.

Same difference ;)

It's probably not a big deal, though.  After all, technically it's 
still the "bitwise and operator", even if it can be overridden to 
do something completely different.  So calling it BITWISE_AND is 
still reasonable.



More information about the antlr-interest mailing list