From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA01653; Fri, 16 Jan 2004 20:01:16 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA01644 for ; Fri, 16 Jan 2004 20:01:15 +0100 (MET) Received: from fichte.ai.univie.ac.at (fichte.ai.univie.ac.at [131.130.174.156]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id i0GJ1E503829 for ; Fri, 16 Jan 2004 20:01:14 +0100 (MET) Received: from fichte.ai.univie.ac.at (markus@localhost [127.0.0.1]) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) with ESMTP id i0GJ1AHn030348; Fri, 16 Jan 2004 20:01:10 +0100 Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) id i0GJ1APZ030347; Fri, 16 Jan 2004 20:01:10 +0100 Date: Fri, 16 Jan 2004 20:01:10 +0100 From: Markus Mottl To: Brian Hurt Cc: Richard Jones , Ocaml Mailing List Subject: Re: [Caml-list] ANNOUNCE: mod_caml 1.0.6 - includes security patch Message-ID: <20040116190110.GB26828@fichte.ai.univie.ac.at> Mail-Followup-To: Brian Hurt , Richard Jones , Ocaml Mailing List References: <20040116093454.GA23909@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 foo:01 matchings:01 regex:01 regex:01 foo:01 pcre-ocaml:01 pcre:01 compiler:01 caml:01 closure:01 patch:02 match:02 match:02 mottl:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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