X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;ds=sidebyside;f=sem.icl;h=02d01174b1734a3731e3c6d8520eaf7f8a3632ba;hb=42f469bb622f254f8008b064bdb720c72daaf2e3;hp=1cb9e546002911c200955c5444817522211aae98;hpb=c270b0fc79caa24c08c2d00c2e8205bbd47921ed;p=cc1516.git diff --git a/sem.icl b/sem.icl index 1cb9e54..02d0117 100644 --- a/sem.icl +++ b/sem.icl @@ -1,6 +1,7 @@ implementation module sem -from Data.Map import :: Map +import qualified Data.Map as Map +from Data.Func import $ import Data.Either import Control.Monad.State import StdMisc @@ -9,17 +10,17 @@ import AST from parse import :: ParserOutput from yard import :: Error -:: Gamma :== Map String Type +:: Gamma :== 'Map'.Map String Type :: Env a :== State Gamma a sem :: ParserOutput -> SemOutput sem (Left p) = Left p -sem (Right (AST vd fd)) = undef +sem (Right (AST vd fd)) = Right $ AST vd fd // foldM semVarDecl vd // >>= \gamma ->foldM typecheck gamma fd -semVarDecl :: Env VarDecl -semVarDecl = undef +semVarDecl :: VarDecl -> Env VarDecl +semVarDecl (Vardecl pos type ident expr) = undef