picolisp/src/Main.hs

22 lines
544 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
Right e -> do
outputStrLn . show $ eval e
repl