On Fri, 2008-10-10 at 15:00 -0500, Tommy M. McGuire wrote: > On 10 Oct 2008, at 7:05 pm, Jonathan Cast wrote: > > Parsec makes recursive descent parsers as easy to use in Haskell as > > regexps are in Perl. No reason not to expose newcomers to Haskell to > > the thing it does best. > > Is it wrong to use Parsec to parse regular expressions for a really > simple regex engine[4]?
That looks about right. And, as you point out, it's easier to understand than a direct parser. I would also re-code the engine itself in Parsec, though (probably using a finite state machine implementation, which (I think; I haven't tried it yet) would end up looking rather like a manual unfolding along the lines of Koen Claessen's parallel parsing process [1]). jcc [1] http://www.cs.chalmers.se/~koen/Papers/parsing-pearl.ps _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe