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.

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to