scala/ex_jvm.scala
changeset 226 df455e0a9f98
parent 225 0974c59e7029
child 227 10d4d20c4e4b
--- a/scala/ex_jvm.scala	Thu Mar 14 18:46:34 2013 +0000
+++ b/scala/ex_jvm.scala	Thu Mar 14 19:03:05 2013 +0000
@@ -74,7 +74,7 @@
 
 
 def compile(f: Rec, ns: List[Int]) : Unit = {
-  val class_name = "LOOP"
+  val class_name = "Prog"
   val (aprog, res, max) = compile_rec(f)
 
   val init_code = init_regs(ns.padTo(max, 0))
@@ -94,12 +94,19 @@
   println("Result: " + result + "  Time: " + (end - start) / 1.0e9)
 }
 
+print("Add(69, 30)   "); compile(Add, List(69, 30))
+print("Mult(13, 9)   "); compile(recs.Mult, List(13, 9))
+print("Power(3, 4)   "); compile(Power, List(3, 4))
+print("Strt:  ");  compile(Strt(2), List(2,3))
 
-//compile(S, List(3))
-//compile(Fact, List(11))
-//compile(Fact, List(12))
-//compile(Fact, List(13))
-//compile(Fact, List(14))
+println("FACTORIAL")
+
+for (i <- 5 to 9) {
+  println("Input:  " + i)
+  compile(Fact, List(i))
+}
+
+println("PRIME TEST")
 
 for (i <- 10 to 20) {
   println("Input:  " + i)