X-Git-Url: https://git.rmz.io/my-scheme.git/blobdiff_plain/b388d53e751db6d925a39c06dc871c125799b8e5..d06e8ae01efc00ea0eb6f0bed346032b004aca57:/app/Main.hs diff --git a/app/Main.hs b/app/Main.hs index c64fd18..7c987ce 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -15,6 +15,19 @@ symbol = oneOf "!#$%&|*+-/:<=>?@^_~" spaces :: Parser () spaces = skipMany space +parseString :: Parser LispVal +parseString = do + char '"' + x <- many (noneOf "\"") + char '"' + return $ String x + +parseAtom :: Parser LispVal +parseAtom = do + a <- letter <|> symbol + b <- many (letter <|> digit <|> symbol) + return $ Atom (a:b) + readExpr :: String -> String readExpr input = case parse (spaces >> symbol) "lisp" input of Left err -> "No match: " ++ show err