X-Git-Url: https://git.rmz.io/my-scheme.git/blobdiff_plain/d06e8ae01efc00ea0eb6f0bed346032b004aca57..7495ece1a44cd1a8cccae2bdbc61fa6873f106d2:/app/Main.hs?ds=inline diff --git a/app/Main.hs b/app/Main.hs index 7c987ce..6daf522 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,4 +1,5 @@ module Main where +import Control.Monad import Text.ParserCombinators.Parsec hiding (spaces) import System.Environment @@ -26,7 +27,14 @@ parseAtom :: Parser LispVal parseAtom = do a <- letter <|> symbol b <- many (letter <|> digit <|> symbol) - return $ Atom (a:b) + let atom = a:b + return $ case atom of + "#t" -> Bool True + "#f" -> Bool False + _ -> Atom atom + +parseNumber :: Parser LispVal +parseNumber = liftM (Number . read) $ many1 digit readExpr :: String -> String readExpr input = case parse (spaces >> symbol) "lisp" input of