diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-01-03 14:16:31 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-01-03 14:16:31 +0900 |
| commit | d4edcd19883929b6969c8d881680a21bcd55ddfe (patch) | |
| tree | 2599d74a5c8ae86a26220917177b6fc3b7bb20e1 /arith/Main.hs | |
| parent | c5d7583bd9febdbb70322c08fc4cacdf2c7d11e5 (diff) | |
| download | TaPL-impls-d4edcd19883929b6969c8d881680a21bcd55ddfe.tar.gz TaPL-impls-d4edcd19883929b6969c8d881680a21bcd55ddfe.tar.zst TaPL-impls-d4edcd19883929b6969c8d881680a21bcd55ddfe.zip | |
Diffstat (limited to 'arith/Main.hs')
| -rw-r--r-- | arith/Main.hs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arith/Main.hs b/arith/Main.hs new file mode 100644 index 0000000..45b10eb --- /dev/null +++ b/arith/Main.hs @@ -0,0 +1,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 |
