Merge branch 'master' of https://github.com/dopefishh/cc1516
[cc1516.git] / sem.icl
diff --git a/sem.icl b/sem.icl
index f0241e1..19092df 100644 (file)
--- a/sem.icl
+++ b/sem.icl
@@ -61,7 +61,7 @@ instance toString SemError where
 sem :: AST -> SemOutput
 sem (AST vd fd) = case evalStateT m ('Map'.newMap, getRandomStream 1) 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 -> 
@@ -159,4 +159,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]