Merge branch 'master' of https://github.com/dopefishh/cc1516
[cc1516.git] / sem.icl
1 implementation module sem
2
3 import qualified Data.Map as Map
4 from Data.Func import $
5 import Data.Either
6 import Control.Monad.State
7 import StdMisc
8
9 import AST
10 from parse import :: ParserOutput
11 from yard import :: Error
12
13 :: Gamma :== 'Map'.Map String Type
14 :: Env a :== State Gamma a
15
16 sem :: ParserOutput -> SemOutput
17 sem (Left p) = Left p
18 sem (Right (AST vd fd)) = Right $ AST vd fd
19 // foldM semVarDecl vd
20 // >>= \gamma ->foldM typecheck gamma fd
21
22 semVarDecl :: VarDecl -> Env VarDecl
23 semVarDecl (Vardecl pos type ident expr) = undef
24
25
26
27