blob: 45b10eb14910043b26c3b06956449ef92638255d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
module Main where
import System.IO (hFlush, stdout)
import Text.Parsec (parse)
import Core
import Parser
repl :: IO ()
repl = do
putStr "arith> "
hFlush stdout
line <- getLine
if line == ":q"
then putStrLn "Bye!"
else do
case parse parseProgram "<stdin>" line of
Left err -> print err
Right term -> print (eval term)
repl
main :: IO ()
main = repl
|