]> git.rmz.io Git - my-scheme.git/blobdiff - app/Main.hs
Ignore spaces
[my-scheme.git] / app / Main.hs
index 16e49391cac7ef3f27a6cf3c0abffab9d0fe3794..852089135df8fa8b9ccef54f9699d95bc41d8df2 100644 (file)
@@ -1,7 +1,19 @@
 module Main where
 module Main where
+import Text.ParserCombinators.Parsec hiding (spaces)
 import System.Environment
 
 import System.Environment
 
+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
 main :: IO ()
 main = do
-    args <- getArgs
-    putStrLn (show (read (args !! 0) + read (args !! 1)))
+    args <- getLine
+    putStrLn (readExpr args)