progs/while-compiler-arrays/compile_bfc.sc
changeset 730 18fee9d3b6a8
parent 725 f345e89895f5
child 732 c7bdd7eac4cb
equal deleted inserted replaced
729:b147a10be8dd 730:18fee9d3b6a8
   241   println(s"BF pre-processing of $name")
   241   println(s"BF pre-processing of $name")
   242   val bf_string = bf_str(prog)
   242   val bf_string = bf_str(prog)
   243   println(s"BF parsing (program length ${bf_string.length} characters)")
   243   println(s"BF parsing (program length ${bf_string.length} characters)")
   244   val (time, bf_prog) = 
   244   val (time, bf_prog) = 
   245     time_needed(1, fastparse.parse(bf_string, Stmts(_)).get.value)
   245     time_needed(1, fastparse.parse(bf_string, Stmts(_)).get.value)
   246   println(s"BF generated WHILE program (needed $time for parsing)")
   246   println(s"BF generated WHILE program (needed $time secs for parsing)")
   247   compile_and_run(bf_prog, name)
   247   compile_and_run(bf_prog, name)
   248 }
   248 }
   249 
   249 
   250 // a benchmark program (counts down from 'Z' to 'A')
   250 // a benchmark program (counts down from 'Z' to 'A')
   251 val bf0 = """>++[<+++++++++++++>-]<[[>+>+<<-]>[<+>-]++++++++
   251 val bf0 = """>++[<+++++++++++++>-]<[[>+>+<<-]>[<+>-]++++++++