regexp to matchspec

Ulf Wiger (AL/EAB) ulf.wiger@REDACTED
Mon Jan 23 15:24:06 CET 2006

Yeah, well, I didn't want to open _that_
can of worms. (:

Just being able to use the relatively limited
expressiveness of regexp.erl is a huge step
forward compared to match specs, I think
(when matching on strings, of course).

Also, Robert Virding's regexp library has 
a pretty nice internal form that's quite easy
to grasp, and that's what I've based the conversion

Btw, I corrected the bug in my program to properly
bail out when it gets too complex:

1> f(Re), catch (Re =

2> f(Re), catch (Re =

I set the default limit to 100,000 tail ops past
the last variable (in total, all branches counted).
One can increase it carefully (requires a recompile)
and measure the memory consumption and conversion 
time to suit individual tastes.

I also made pclosure() and kclosure both insert
'false' if they hit the lookahead limit. I don't
know if 'true' would be more appropriate (or if it
matters at all), but it seems sensible that they 
both act the same way...

No new code distributed, unless requested.


> -----Original Message-----
> From: owner-erlang-questions@REDACTED 
> [mailto:owner-erlang-questions@REDACTED] On Behalf Of Vlad 
> Dumitrescu XX (LN/EAB)
> Sent: den 23 januari 2006 14:59
> To: Erlang Questions
> Subject: RE: regexp to matchspec
> Hi,
> I don't have any comments on your idea or your code, Ulf, but 
> it might be of interest to check the way Perl 6 is revisiting 
> regexps 
> Not entirely relevant to Erlang regexps and way too detailed 
> for a non-Perl programmer, but might stir up an idea or two 
> :-) The one thing that stuck for me is that they try to make 
> regexp language more like a grammar, which I think is a Good Thing.
> Regards,
> Vlad

More information about the erlang-questions mailing list