]> git.rmz.io Git - my-scheme.git/blob - app/Main.hs
c64fd18d83b0cdf0575889388df8cfa6344619c8
[my-scheme.git] / app / Main.hs
1 module Main where
2 import Text.ParserCombinators.Parsec hiding (spaces)
3 import System.Environment
4
5 data LispVal = Atom String
6 | List [LispVal]
7 | DottedList [LispVal] LispVal
8 | Number Integer
9 | String String
10 | Bool Bool
11
12 symbol :: Parser Char
13 symbol = oneOf "!#$%&|*+-/:<=>?@^_~"
14
15 spaces :: Parser ()
16 spaces = skipMany space
17
18 readExpr :: String -> String
19 readExpr input = case parse (spaces >> symbol) "lisp" input of
20 Left err -> "No match: " ++ show err
21 Right val -> "Found value"
22
23 main :: IO ()
24 main = do
25 args <- getLine
26 putStrLn (readExpr args)