]> git.rmz.io Git - my-scheme.git/blobdiff - app/Main.hs
readExpr function to check whether the input matches symbol
[my-scheme.git] / app / Main.hs
index c0766c1faa3645d237fed54bc0e83d3dbcdd4d08..a94dc2ce2355835c62533047f14994df94f28319 100644 (file)
@@ -1,7 +1,16 @@
 module Main where
+import Text.ParserCombinators.Parsec
 import System.Environment
 
+symbol :: Parser Char
+symbol = oneOf "!#$%&|*+-/:<=>?@^_~"
+
+readExpr :: String -> String
+readExpr input = case parse symbol "lisp" input of
+    Left err -> "No match: " ++ show err
+    Right val -> "Found value"
+
 main :: IO ()
 main = do
-    args <- getArgs
-    putStrLn ("Hello, " ++ args !! 0)
+    args <- getLine
+    putStrLn (readExpr args)