]> ruin.nu Git - proglang.git/blobdiff - Interpret.hs
added constructor for declaration with default value
[proglang.git] / Interpret.hs
index 8ac65bf247c9acf10699573d40669e65ca43782b..fd04dcd722d9e33d8b65a70c292c96bd161e48e4 100644 (file)
@@ -109,6 +109,10 @@ execute (SBlock ss) = pushAndPop $ mapM execute ss
 execute (SWhile e s) = do
        (VBool b) <- eval e
        if b then pushAndPop (execute s) >> execute (SWhile e s) else return ()
+execute (SDeclD t i) = execute (SDecl t i $ case t of
+       TInt -> EInt 0
+       TBool -> EBool False
+       )
 execute (SDecl t i e) =do
        e' <- eval e
        (m:ms) <- get