solutions5/bfc.scala
changeset 234 c51305a2217f
parent 233 38ea26f227af
child 236 e461b5325b5e
--- a/solutions5/bfc.scala	Thu Dec 06 18:37:17 2018 +0000
+++ b/solutions5/bfc.scala	Thu Dec 06 18:50:53 2018 +0000
@@ -1,7 +1,7 @@
 // Part 2 about a "Compiler" for the Brainf*** language
 //======================================================
 
-//object CW10b {
+object CW10b {
 
 // !!! Copy any function you need from file bf.scala !!!
 //
@@ -254,7 +254,7 @@
 
 def spl(s: String) = splice(s.toList, Nil).reverse
 
-spl(load_bff("benchmark.bf"))
+//spl(load_bff("benchmark.bf"))
 
 def combine(s: String) : String = {
   (for ((c, n) <- spl(s)) yield c match {
@@ -267,7 +267,7 @@
 }
 
 
-combine(load_bff("benchmark.bf"))
+//combine(load_bff("benchmark.bf"))
 
 def compute4(pg: String, tb: Map[Int, Int], pc: Int, mp: Int, mem: Mem) : Mem = {
   if (0 <= pc && pc < pg.length) { 
@@ -295,8 +295,8 @@
   compute4(pg_opt, jtable(pg_opt), 0, 0, m)
 }
 
-
-combine(optimise(load_bff("benchmark.bf"))) // => """>A+B[<A+M>A-A]<A[[....."""
+// testcases
+//combine(optimise(load_bff("benchmark.bf"))) // => """>A+B[<A+M>A-A]<A[[....."""
 
 //time_needed(1, run4(load_bff("benchmark.bf")))
 
@@ -306,4 +306,4 @@
 //time_needed(1, run4(load_bff("mandelbrot.bf")))
 
 
-//}
+}