picolisp/src/Main.hs

22 lines
583 B
Haskell
Raw Normal View History

2021-02-24 15:44:12 +00:00
module Main where
import Parser
import Evaluator
import System.Console.Haskeline
2021-02-24 15:44:12 +00:00
main :: IO ()
main = runInputT defaultSettings repl
where repl = do
line <- getInputLine "picolisp> "
case line of
Nothing -> return ()
Just s -> do
let eithE = parseExpression s
case eithE of
Left err -> do
outputStrLn $ show err
repl
2021-02-24 19:23:58 +00:00
Right e -> outputStrLn (case eval e of
Right out -> show out
2021-02-25 17:18:35 +00:00
Left err -> err) >> repl