[antlr-interest] Can subrules be set to 'n-to-m'?

John D. Mitchell johnm-antlr at non.net
Fri Mar 25 09:13:32 PST 2005


>>>>> "Scott" == Scott Stanchfield <scott at javadude.com> writes:
[...]

> I think the "+" is redundant here...

So are you also suggesting that (ID)+ should only be written as
e.g. (ID)[1]?

That would be completely silly.  It looks like an indexed access operation,
it's different than the base case, etc.


[...]

> (...)[n,m]

Yes, I agree that it use the square brackets (ala math notation):

(...)+[n,m]

with the ,m part optional.


> Should suffice.

> BUT,

> While I'm at it, can (...) be optional for single-ref repetition? For
> example, I'd love to be able to use:

I don't care for that.  Why?  Because it means that people have to scan and
understand two different forms for the same fundamental meaning.  I.e.,
it's a Good Thing(tm) that the parentheses make the loops stand out
distinctively.

Take care,
	John


More information about the antlr-interest mailing list