www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Regular Expressions

reply "Craig Black" <cblack ara.com> writes:
With all this discussion of $ stuff for regular expressions, I was 
wondering, aren't the templated compile-time regular expressions eventually 
going to replace the current regular expression implementation?  I would 
assume they will be much much faster.  I think we should keep that in mind 
when adding syntax sugar to the language. We should ensure that whatever 
syntax sugar is added, it will be compatible with the newer faster regex 
stuff.

-Craig 
Feb 16 2006
parent reply pragma <pragma_member pathlink.com> writes:
In article <dt2jvd$14s1$1 digitaldaemon.com>, Craig Black says...
With all this discussion of $ stuff for regular expressions, I was 
wondering, aren't the templated compile-time regular expressions eventually 
going to replace the current regular expression implementation?  I would 
assume they will be much much faster.  I think we should keep that in mind 
when adding syntax sugar to the language. We should ensure that whatever 
syntax sugar is added, it will be compatible with the newer faster regex 
stuff.

-Craig 

That's a good question. I never did any timed comparisons of the template solution versus Walter's implementation. Although, making the templated version opMatch friendly should be pretty easy to do. Anyone have any nanosecond (Windows) timing code handy? Anyway, I really feel (as others do) that tying the evaulation of "<string> <opMatch> <operand>" to std.regexp is not the ideal way forward (but it does work). If Walter were to move beyond this to a compile-time regex operation instead, I'd insist that a non-library approach be used as it would invariably yield a faster expression processor. However, the unfortunate consequence of that would be a harder to implement language standard as it would require a whole 'nother codegen engine within the compiler itself. - Eric Anderton at yahoo
Feb 16 2006
parent "Walter Bright" <newshound digitalmars.com> writes:
"pragma" <pragma_member pathlink.com> wrote in message 
news:dt2lrp$16dt$1 digitaldaemon.com...
 Anyone have any nanosecond (Windows) timing code handy?

Sure. Compile with -profile <g>.
Feb 16 2006