import Typecheck
import Interpret
-import Control.Monad.State hiding (State)
-import Control.Concurrent.MVar
-import Data.Map as Map hiding (showTree)
import ErrM
Ok (Program s) -> let (fun,st) = splitFunStm (s) in do
putStrLn "\nParse Successful!"
showTree v (Program s)
- runStateT (do mapM Typecheck.addFunction fun; mapM typeCheckFunction fun; mapM typeCheckStm st) Typecheck.emptyState
+ typeCheck fun st
print "The program is type-correct!!"
print "Running program:"
- mv <- newEmptyMVar
- runStateT (do mapM Interpret.addFunction fun; mapM execute st) Interpret.emptyState{ret=mv}
+ interpret fun st
print "Done running program!"
- return ()
showTree :: (Show a, Print a) => Int -> a -> IO ()
showTree v tree