X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=Typecheck.hs;h=1b0baa00ed5d48dc760f029f9759e8bb821eed9c;hb=ad65f2bc9228f04e0df3e309518f3c5b27cbfc06;hp=70aad706a88cfc5b38a1863744ccce563772e490;hpb=fd3bc0ef4542783846af4e2c4f986e94f96c74ff;p=proglang.git 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