[Haskell-cafe] Pattern match failure

Jackm139 jackmarathon at gmail.com
Wed Apr 9 22:05:05 EDT 2008

I'm trying to write a function to recognize a context free grammar, but I
keep getting pattern match failure errors. This is what I have:

data Grammar c = Brule c c c | Rule c c

gez = [(Brule 'S' 'p' 'D'),(Brule 'D' 't' 'E'),(Rule 'E' 'j')]

recog :: String -> String -> [Grammar Char] -> Bool
recog a b list = case list of
	[Brule x y z] -> if a == [x] then recog [z] b list else recog a b list
	[Rule x y] -> True

how can I solve this pattern matching error?

View this message in context: http://www.nabble.com/Pattern-match-failure-tp16600643p16600643.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

More information about the Haskell-Cafe mailing list