Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] ANNOUNCE: mod_caml 1.0.6 - includes security patch
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] ANNOUNCE: mod_caml 1.0.6 - includes security patch
On Fri, 16 Jan 2004, Brian Hurt wrote:
> That (or something close to that) could be done via a library.  What I'd 
> like to see is to be able to pattern match on regexs, like:
> 
> match str with
> 	| /ab+/ -> ...
> 	| /foo(bar)*/ -> ...
> 
> etc.  The compiler could then combine all the matchings into a single DFA, 
> improving performance over code like:
> 
> if (regex_match str "ab+") then
>     ...
> else if (regex_match str "foo(bar)*") then
>     ...
> else 
>     ...

I'd like to point out that PCRE-OCaml has functionality for using
callouts, i.e. you can indeed put all alternatives into one huge regular
expression, mark them with callout numbers, and thus execute code (a
closure passed to the matching engine) depending on the currently matched
alternative (and even explicitly backtrack if you want). Very powerful...

Unfortunately, the automaton used internally by PCRE is not a DFA.
It's still optimized to some extent, but I don't know the details.

Regards,
Markus

-- 
Markus Mottl          http://www.oefai.at/~markus          markus@oefai.at

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners