X-Git-Url: https://ruin.nu/git/?p=proglang.git;a=blobdiff_plain;f=Typecheck.hs;fp=Typecheck.hs;h=1b0baa00ed5d48dc760f029f9759e8bb821eed9c;hp=70aad706a88cfc5b38a1863744ccce563772e490;hb=9625a8a7eb7aebeb161ca15cf66cff5699f89103;hpb=97719af3b544b9fae80e886bf6a49c51b4a320a9 diff --git a/Typecheck.hs b/Typecheck.hs index 70aad70..1b0baa0 100644 --- a/Typecheck.hs +++ b/Typecheck.hs @@ -1,4 +1,4 @@ -module Typecheck (typeCheckExp, typeCheckStm, typeCheckVar) where +module Typecheck (typeCheck,typeCheckExp, typeCheckStm, typeCheckVar) where import Abssyntax @@ -16,6 +16,9 @@ assert :: Monad m => Bool -> String -> m () assert True _ = return () assert False s = fail s +typeCheck :: [Stm] -> IO () +typeCheck s = runStateT (mapM typeCheckStm s) [empty] >> return () + typeCheckExp :: (MonadState Types m) => Exp -> m Type typeCheckExp (BiOpExp e o e') = do t1 <- typeCheckExp e