progs/fun.scala
changeset 225 ef573e8fc86e
parent 223 e4b29b57f6a3
child 311 6719e8d10a0d
--- 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")