[Haskell-cafe] Efficient parallel regular expressions

Martijn van Steenbergen martijn at van.steenbergen.nl
Tue Nov 4 12:05:09 EST 2008


Hello all,

For my mud client Yogurt (see hackage) I'm currently working on
improving the efficiency of the hooks. Right now several hooks, each
consisting of a regex and an action can be active at the same time.
Every time a line of input is available (usually several times a second)
I run the line through all the available regexes and execute the first
matching action.

I figured this is not the cleverest approach and it'd be better if I
|'ed all regexes into one big DFA. However, how do I then find out which
of the original hooks matched and so which action to execute?

As far as I know there's no way to do that with Text.Regex. Alex looks
promising but is really only an executable and doesn't offer an API.
I've also found mr. João Saraiva's HaLex but I don't know if that was
meant to be used seriously.

Does anyone have any experience with this? What's the best way to
achieve this?

Thanks much,

Martijn.



More information about the Haskell-Cafe mailing list