diff options
author | Paweł Dybiec <pawel.to.malpa@gmail.com> | 2020-01-20 21:13:37 +0100 |
---|---|---|
committer | Paweł Dybiec <pawel.to.malpa@gmail.com> | 2020-01-20 21:13:37 +0100 |
commit | e885cb8b286cccfb94cc5f81a3acd6f259ed6c28 (patch) | |
tree | b56c3415009730a6219b8636503e22beb8cc1c71 /app | |
parent | Evaluator (diff) |
Add evaluation of whole programs, typechecking functions and main main
Diffstat (limited to 'app')
-rw-r--r-- | app/Main.hs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/app/Main.hs b/app/Main.hs index de1c1ab..efe495b 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,6 +1,18 @@ module Main where -import Lib +import Syntax +import Typecheck +import Eval +import Control.Monad.Except main :: IO () -main = someFunc +main = do + input <-getContents + let program = (read input)::Program + case runExcept $ wfProgram program of + Left s -> print s + Right () -> + let (ret,state) = runProgram program in + case ret of + Left err-> print$ "Program finished with error" ++show err ++ "in state " ++ show state + Right _ -> print$ "Program finished by going to the end to state" ++ show state |