X-Git-Url: https://git.rmz.io/my-scheme.git/blobdiff_plain/5bd76ea90313c3b469e1b7fce192f3cd54c57a33..b388d53e751db6d925a39c06dc871c125799b8e5:/app/Main.hs diff --git a/app/Main.hs b/app/Main.hs index cdd564b..c64fd18 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,7 +1,26 @@ module Main where +import Text.ParserCombinators.Parsec hiding (spaces) import System.Environment +data LispVal = Atom String + | List [LispVal] + | DottedList [LispVal] LispVal + | Number Integer + | String String + | Bool Bool + +symbol :: Parser Char +symbol = oneOf "!#$%&|*+-/:<=>?@^_~" + +spaces :: Parser () +spaces = skipMany space + +readExpr :: String -> String +readExpr input = case parse (spaces >> symbol) "lisp" input of + Left err -> "No match: " ++ show err + Right val -> "Found value" + main :: IO () main = do - args <- getArgs - putStrLn (args !! 0 ++ args !! 1) + args <- getLine + putStrLn (readExpr args)