--- a/progs/compile2.scala Sun Nov 17 09:18:47 2019 +0000
+++ b/progs/compile2.scala Sun Nov 17 16:12:16 2019 +0000
@@ -481,26 +481,27 @@
"\n" ++
//"new field[30000];\n" ++
"ptr := 15000;" ++
- instrs2(prog) ++
+ instrs(prog) ++
"skip"
}
def bf_run(prog: String, name: String) = {
println("BF processing start")
val bf_string = bf_str(prog).replaceAll("\\s", "")
+
println(s"BF parsing start (string length ${bf_string.length})")
val bf_prog = Stmts.parse_all(bf_string).toList.head
- println("BF Compile start")
+ println(s"BF Compile start ${bf_string.toList.length} characters")
compile_run(Array("field", 30000) :: bf_prog, name)
}
// a benchmark program (counts down from 'Z' to 'A')
-val b0 = """>++[<+++++++++++++>-]<[[>+>+<<-]>[<+>-]++++++++
+val bf0 = """>++[<+++++++++++++>-]<[[>+>+<<-]>[<+>-]++++++++
[>++++++++<-]>.[-]<<>++++++++++[>++++++++++[>++
++++++++[>++++++++++[>++++++++++[>++++++++++[>+
+++++++++[-]<-]<-]<-]<-]<-]<-]<-]++++++++++."""
-bf_run(b0, "bench")
+bf_run(bf0, "bench")
@@ -513,7 +514,11 @@
bf_run("""++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++
..+++.>>.<-.<.+++.------.--------.>>+.>++.""", "hello")
-bf_run("""+++++++++++
+println("BF SIER Prog")
+println(bf_str(bf1).replaceAll("\\s", "").split(";").toList.length)
+
+
+val bf2 = """+++++++++++
>+>>>>++++++++++++++++++++++++++++++++++++++++++++
>++++++++++++++++++++++++++++++++<<<<<<[>[>>>>>>+>
+<<<<<<<-]>>>>>>>[<<<<<<<+>>>>>>>-]<[>++++++++++[-
@@ -523,7 +528,12 @@
+++++++++++++++++++++++.[-]]++++++++++<[->-<]>++++
++++++++++++++++++++++++++++++++++++++++++++.[-]<<
<<<<<<<<<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-]<-[>>.>.<<<
- [-]]<<[>>+>+<<<-]>>>[<<<+>>>-]<<[<+>-]>[<+>-]<<<-]""", "fibs")
+ [-]]<<[>>+>+<<<-]>>>[<<<+>>>-]<<[<+>-]>[<+>-]<<<-]"""
+
+bf_run(bf2, "fibs")
+
+println("BF FIB Prog")
+println(bf_str(bf2).replaceAll("\\s", "").split(";").toList.length)
/*