X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=sem.icl;h=c5e14f36c26cc3337565d46e1e2013b843a2de37;hb=c13e6ac6caa1b0d3578caf9310303920d47cf85f;hp=8224a4f2a3da4a72f5cee69199337e42e1cc2ba1;hpb=f5e125920d85bc53eda7b51f3f03e89fcaf3a0ce;p=cc1516.git diff --git a/sem.icl b/sem.icl index 8224a4f..c5e14f3 100644 --- a/sem.icl +++ b/sem.icl @@ -59,9 +59,9 @@ instance toString SemError where toString t1, ". Given: ", toString t2] sem :: AST -> SemOutput -sem (AST vd fd) = case evalStateT m ('Map'.newMap, getRandomStream 0) of +sem (AST vd fd) = case runStateT m ('Map'.newMap, getRandomStream 0) of Left e = Left [e] - Right (vds, fds) = Right (AST vds fds) + Right ((vds, fds), gamma) = Right ((AST vds fds), gamma) where m :: Env (([VarDecl], [FunDecl])) m = (mapM semVarDecl vd) >>= \vds -> @@ -155,4 +155,8 @@ extrPos (CharExpr p _) = p extrPos (BoolExpr p _) = p extrPos (FunExpr p _) = p extrPos (EmptyListExpr p) = p -extrPos (TupleExpr p _) = p \ No newline at end of file +extrPos (TupleExpr p _) = p + +instance toString Gamma where + toString (mp, _) = concat + [concat [k, ": ", toString v, "\n"]\\(k, v) <- 'Map'.toList mp]