earthquake changes of std.regexp to come

BCS ao at pathlink.com
Tue Feb 17 12:16:53 PST 2009


Reply to Jarrett,

> On Tue, Feb 17, 2009 at 2:47 PM, Daniel de Kok <me at danieldk.org>
> wrote:
> 
>> Actually, I was wondering why nobody is considering real regular
>> languages anymore, that can be compiled to a normal finite state
>> recognizer or transducer. While this may not be as fancy as Perl-like
>> extensions, they are much faster, and it's easier to do fun stuff
>> such as composition.
>> 
> Tango's regex engine is just that.  It uses a tagged NFA method.
> http://www.dsource.org/projects/tango/docs/current/tango.text.Regex.ht
> ml
> 
> The problem with this method is that while it's certainly faster to
> match, it's MUCH slower to compile.  There are no pathological
> matches; only pathological compiles ;)  I'm talking 60-70 seconds to
> compile a more complex regex.

could this be transitioned to CTFE? you could even have a debug mode that 
delays till runtime

RegEx mather = new CTFERegEx!("some regex");


class CTFERegEx(char[] regex) : RegEx
{
       debug(NoCTFE)  static char[] done;
       else     static const char[] done = CTFECompile(regex);

       public this()
       {
          debug(NoCTFE) if(done == null) done = CTFECompile(regex);

          base(done)
       }
}





More information about the Digitalmars-d mailing list