[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: repeating patterns and ...



On Wed, Oct 16, 2013 at 08:31:54PM -0700, Michael Montague wrote:
> Scheme already has one way of specifying repeating patterns: ... How 
> about using similar syntax for regular expressions?
> 
> (* <sre>) would change to (<sre> ...)

That's a nice alternative syntax!  However,

> The general case of (** <from> <to> <sre>) could change to (<sre> ... 
> <from> <to>)
> 
> or to (<sre> (... <from> <to>))
> 
> (? <sre>) changes to (<sre> ... 0 1) or to (<sre> (... 0 1))
> (+ <sre>) changes to (<sre> ... 1) or to (<sre> (... 1))

This is rather ugly IMO.  Also, more generally speaking, the
symbols that SRE uses are "operators", which for generality's sake
should all be in operator position.  That would also make it slightly
easier to compile due to being more general.

Cheers,
Peter
-- 
http://www.more-magic.net