From e885cb8b286cccfb94cc5f81a3acd6f259ed6c28 Mon Sep 17 00:00:00 2001 From: Paweł Dybiec Date: Mon, 20 Jan 2020 21:13:37 +0100 Subject: Add evaluation of whole programs, typechecking functions and main --- app/Main.hs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'app') 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 -- cgit 1.4.1