X-Git-Url: https://ruin.nu/git/?p=proglang.git;a=blobdiff_plain;f=Interpreter.hs;h=e41759db1c93d656391b6d0d53bf4c20193fb152;hp=6cfbbda91af2804ac58cd53a96a1447e4dd1cea0;hb=08d98a82fabc381a8b101387f39ae5752cfeb314;hpb=8fdc0177fdf518f63819e5b98dd0368fccca6175 diff --git a/Interpreter.hs b/Interpreter.hs index 6cfbbda..e41759d 100644 --- a/Interpreter.hs +++ b/Interpreter.hs @@ -14,6 +14,7 @@ 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 @@ -48,7 +49,8 @@ run v p s = let ts = myLLexer s in case p ts of runStateT (do mapM Typecheck.addFunction fun; mapM typeCheckFunction fun; mapM typeCheckStm st) Typecheck.emptyState print "The program is type-correct!!" print "Running program:" - runStateT (do mapM Interpret.addFunction fun; mapM execute st) Interpret.emptyState + mv <- newEmptyMVar + runStateT (do mapM Interpret.addFunction fun; mapM execute st) Interpret.emptyState{ret=mv} print "Done running program!" return ()