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

Scott Stanchfield scott at javadude.com
Fri Mar 25 19:17:46 PST 2005


No no no no... Silly!

I'm saying that instead of writing

  (foo)+[2,3]

It would just be

  (foo)[2,3]



As for parens, they should be treated the same way as any other expression
language (other than Lisp ;) -- optional to denote precedence where needed.

I hate typing extra stuff for no good reason. If there were a conflict I'd
agree they should be required, but as Einstein said "make it as simple as
possible, and no simpler".

Everyone deals fine with

  x = 3 + 4

Why make them type

  x = (3 + 4)

Unless they need the extra precedence indication?

Later,
-- Scott
 

> -----Original Message-----
> From: John D. Mitchell [mailto:johnm-antlr at non.net] 
> Sent: Friday, March 25, 2005 12:14 PM
> To: Scott Stanchfield
> Cc: 'antlr-interest Interest'
> Subject: RE: [antlr-interest] Can subrules be set to 'n-to-m'?
> 
> >>>>> "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