X-Git-Url: https://ruin.nu/git/?p=proglang.git;a=blobdiff_plain;f=Interpreter.hs;fp=Interpreter.hs;h=ae73abba4a1cff690a8bab18e84c977298c73809;hp=e41759db1c93d656391b6d0d53bf4c20193fb152;hb=04f0a9566794cf761b7bcf83190051a400ec3653;hpb=8687a7c6790e959242228d64c8c513771565f8c1 diff --git a/Interpreter.hs b/Interpreter.hs index e41759d..ae73abb 100644 --- a/Interpreter.hs +++ b/Interpreter.hs @@ -13,9 +13,6 @@ import Abssyntax import Typecheck import Interpret -import Control.Monad.State hiding (State) -import Control.Concurrent.MVar -import Data.Map as Map hiding (showTree) import ErrM @@ -46,13 +43,11 @@ run v p s = let ts = myLLexer s in case p ts of 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