-module Interpret (eval, execute,addFunction, emptyState, Value(..), State(..)) where
+module Interpret (interpret, eval, execute,addFunction, emptyState, Value(..), State(..)) where
import Abssyntax
import Control.Monad.State hiding (State)
data State = State {variables::Variables,functions::(Map Ident Function),ret::(MVar Value)}
+interpret :: [Func] -> [Stm] -> IO ()
+interpret fun st = do
+ mv <- newEmptyMVar
+ runStateT (do mapM Interpret.addFunction fun; mapM execute st) emptyState{ret=mv}
+ return ()
+
--eval :: (MonadState Variables m) => Exp -> m Value
eval :: Exp -> StateT State IO Value
eval (EBool b) = return (VBool b)