print gamma jowww
[cc1516.git] / sem.icl
diff --git a/sem.icl b/sem.icl
index 8224a4f..c5e14f3 100644 (file)
--- 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]