# HG changeset patch # User Christian Urban # Date 1362136670 0 # Node ID b93ec66cf4bb24d6d921d590602953434c81e6d8 # Parent 17d80924af53d0bf2ca6809af75103f969d7adf7 tuning diff -r 17d80924af53 -r b93ec66cf4bb paper.pdf Binary file paper.pdf has changed diff -r 17d80924af53 -r b93ec66cf4bb scala/comp1.scala --- a/scala/comp1.scala Fri Mar 01 11:16:30 2013 +0000 +++ b/scala/comp1.scala Fri Mar 01 11:17:50 2013 +0000 @@ -56,7 +56,7 @@ def compile_Goto(s: Int) = TMGoto.shift(s - 1) -def compile(p: AProg, s: Int, i: AInst) = i match { +def compile_abc(p: AProg, s: Int, i: AInst) = i match { case Inc(n) => compile_Inc(s, n) case Dec(n, e) => compile_Dec(s, n, address(p, e)) case Goto(e) => compile_Goto(address(p, e)) @@ -64,7 +64,7 @@ // component TMs for each instruction def TMs(p: AProg) = - p.zipWithIndex.map{case (i, n) => compile(p, address(p, n), i)} + p.zipWithIndex.map{case (i, n) => compile_abc(p, address(p, n), i)} def toTM(p: AProg) = TMs(p).reduceLeft(_ ++ _) diff -r 17d80924af53 -r b93ec66cf4bb scala/ex.scala --- a/scala/ex.scala Fri Mar 01 11:16:30 2013 +0000 +++ b/scala/ex.scala Fri Mar 01 11:17:50 2013 +0000 @@ -87,11 +87,11 @@ println(Const(1)) -println(compile_rec(Const(1))._1) println(compile_rec(Const(1))) println(compile_rec(Const(1))._1.run(Map(0 -> 1, 1 -> 1, 2 -> 0))) +println(toTM(compile_rec(Const(1))._1.p).run(Tape(1, 1, 0))) println(Add) println(compile_rec(Add)._1) -println(compile_rec(Add)) +println(toTM(compile_rec(Add)._1.p).run(Tape(3, 4, 0))) println(compile_rec(Add)._1.run(Map(0 -> 3, 1 -> 8, 2 -> 0))) //compile_rec(Add)._1.run(Map(0 -> 3, 1 -> 4, 2 -> 0))