bug found by Andres
authorChristian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 10 Dec 2013 17:48:15 +0000
changeset 225 ef573e8fc86e
parent 224 70198792c2aa
child 226 e3c454e31224
bug found by Andres
progs/fun.scala
--- a/progs/fun.scala	Thu Dec 05 10:29:35 2013 +0000
+++ b/progs/fun.scala	Tue Dec 10 17:48:15 2013 +0000
@@ -221,7 +221,7 @@
 // calculating the maximal needed stack size
 def max_stack_exp(e: Exp): Int = e match {
   case Call(_, args) => args.map(max_stack_exp).sum
-  case If(a, e1, e2) => max_stack_bexp(a) + (List(max_stack_exp(e1), max_stack_exp(e1)).max)
+  case If(a, e1, e2) => max_stack_bexp(a) + (List(max_stack_exp(e1), max_stack_exp(e2)).max)
   case Write(e) => max_stack_exp(e) + 1
   case Var(_) => 1
   case Num(_) => 1
@@ -479,5 +479,5 @@
 
 
 //examples
-compile_run("defs.rec")
-//compile_run("fact.rec")
+//compile_run("defs.rec")
+compile_run("fact.rec")