Excerpts from ajb's message of Wed Nov 05 03:59:03 +0100 2008: > G'day all.
Hi, > > Quoting Achim Schneider <[EMAIL PROTECTED]>: > > > 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" Nothing 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)]) Best regards, -- Nicolas Pouillard aka Ertai _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe