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

RE: Scheme acceptance [no flames]



> Has anyone considered porting Olin's SRE regular
> expression syntax to Scheme (see
> http://www.ai.mit.edu/~shivers/sre.txt)?  IMO it is a
> far more understandable notation than Perl's line
> noise, and because it uses s-exps that are transformed
> to POSIX regexp strings, you can include expressions,
> comments and all the other things that Perl only had
> crufty hacks for last time I looked at it.
> 

I just read this -- it seems like a pretty nice system.
Of course, I'm partial to Perl's regex handling probably
due to being dropped on my head as a child.

SRE seems very complete, but I just don't like the
syntax that much (biased).  

I've been thinking for some time about trying to put
Perl's regex stuff in a library that could be called
from Scheme, which might end up looking like:

Perl says:      $foo =~ /"abcd"/mg

(Which returns true if the scalar $foo contains the
letters abcd.  The 'm' means scan multiple lines,
and the 'g' means hit all occurrences.  (Of course, it
will also most likely land in my pile of things I
never get to, but...)

Scheme Perl Regex might look like: 
(match foo "abcd" "mg")   But this is somewhat unfamiliar-looking
(=~ foo "abcd" "mg")	  This is more familiar

I guess I'm just not as elegant-minded as some.  I think
having Perl look-alike regexp's might help adoption:

(=~ foo "^A.*$\n[1-46-9]+")

This might make many people feel at home....

Thoughts?

-Brent