2024-10-05 13:31:09 -07:00
|
|
|
module Main where
|
|
|
|
|
|
2024-11-22 10:36:51 -08:00
|
|
|
import Eval (Env, emptyEnv)
|
|
|
|
|
import Parser (handleFile)
|
2024-11-15 18:39:44 -08:00
|
|
|
import Repl
|
2024-11-11 14:34:55 -08:00
|
|
|
|
2024-10-05 13:31:09 -07:00
|
|
|
main :: IO ()
|
2024-10-05 16:04:13 -07:00
|
|
|
main = do
|
2024-11-15 18:39:44 -08:00
|
|
|
args <- getArgs
|
|
|
|
|
case args of
|
2024-11-17 18:33:14 -08:00
|
|
|
[] -> void repl
|
2024-11-22 10:36:51 -08:00
|
|
|
files -> handleFiles emptyEnv files
|
2024-11-15 18:39:44 -08:00
|
|
|
|
2024-11-22 10:36:51 -08:00
|
|
|
handleFiles :: Env -> [String] -> IO ()
|
2024-11-22 19:44:31 -08:00
|
|
|
handleFiles _ [] = putTextLn "success!"
|
2024-11-22 10:36:51 -08:00
|
|
|
handleFiles env (file : rest) = runExceptT (handleFile env file) >>= either putStrLn (`handleFiles` rest)
|