[Haskell-cafe] Re: Efficient parallel regular expressions
nicolas.pouillard at gmail.com
Wed Nov 5 07:44:37 EST 2008
Excerpts from ajb's message of Wed Nov 05 03:59:03 +0100 2008:
> G'day all.
> Quoting Achim Schneider <barsoap at web.de>:
> > Considering that he's talking about a mud, I figure the grammar is a
> > quite straightforward
> > command = l[eft] | r[ight] | ... | t[ake] <item> | c[ast] <spell>
> > That is, I'd be very surprised if you even need more than two or three
> > characters lookahead, much less backtracking.
> In the case of a command followed by arguments, it would make more
> sense to use a keyword recogniser followed by a command-specific parser.
> One suggestion follows.
Oops there is a bug in there:
GHCI> keywordMatch [("a", 1), ("aa", 2)] "aa"
The third equation of generateTrie' is missing a guard, namely k1 /= k2.
generateTrie' [(k1:ks1,v1),(k2:ks2,v2)] | k1 /= k2
= Node2 k1 (generateTrie [(ks1,v1)]) k2 (generateTrie [(ks2,v2)])
Nicolas Pouillard aka Ertai
More information about the Haskell-Cafe