X-Git-Url: https://ruin.nu/git/?p=proglang.git;a=blobdiff_plain;f=Interpret.hs;fp=Interpret.hs;h=0728d5181c967cf6d109f3327f2d8905e6738b1e;hp=c5ef5e0589a302c44e7ac2436cea97660312c366;hb=9625a8a7eb7aebeb161ca15cf66cff5699f89103;hpb=97719af3b544b9fae80e886bf6a49c51b4a320a9 diff --git a/Interpret.hs b/Interpret.hs index c5ef5e0..0728d51 100644 --- a/Interpret.hs +++ b/Interpret.hs @@ -1,4 +1,4 @@ -module Interpret (eval, execute, Value(VInt, VBool)) where +module Interpret (interpret, eval, execute, Value(VInt, VBool)) where import Abssyntax import Control.Monad.State @@ -14,6 +14,9 @@ instance Show Value where type Variables = [Map Ident Value] +interpret :: [Stm] -> IO () +interpret s = runStateT (mapM execute s) [empty] >> return () + --eval :: (MonadState Variables m) => Exp -> m Value eval :: Exp -> StateT Variables IO Value eval (EBool b) = return (VBool b)