Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 568405b0 authored by Ari Nugraha's avatar Ari Nugraha
Browse files

implement for input number 0-9

parent e6fa7b6f
Branches
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ import Text.Parsec.String
import Language.Lambda.Expression
parseExpr :: String -> Either ParseError (LambdaExpr String)
parseExpr = parse (whitespace *> expr <* eof) ""
parseExpr kata = parse (whitespace *> expr <* eof) "" (doOperation kata)
expr :: Parser (LambdaExpr String)
expr = try app <|> term
......@@ -52,6 +52,9 @@ symbol = void . lexeme . char
keyword :: String -> Parser ()
keyword = void . lexeme . string
doOperation "" = ""
doOperation (x:xs) = ubahKeChurch x ++ doOperation xs
ubahKeChurch :: Char -> [Char]
ubahKeChurch '+' = "(\\w y x. y (w y x))"
ubahKeChurch '*' = "(\\x y z . x (y z))"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment