diff -r f25d338d16c9 -r 0cb4bf2469d1 progs/while-arrays/compile_bfc.sc --- a/progs/while-arrays/compile_bfc.sc Sat Nov 09 06:31:45 2024 +0000 +++ b/progs/while-arrays/compile_bfc.sc Fri Nov 22 12:42:07 2024 +0000 @@ -16,7 +16,7 @@ // // Call with scala-cli: // -// scala-cli --dep com.lihaoyi::fastparse:3.0.2 compile_bfc.sc +// scala-cli --dep com.lihaoyi::fastparse:3.1.1 compile_bfc.sc // // Scala-cli is another REPL for scala. Unfortunately // fastparse used in this file is not yet supported @@ -25,8 +25,8 @@ // compile_arrays.sc (no peephole optimisations) // compile_arrays2.sc (peephole optimisations applied) -//> using file compile_arrays2.sc -import compile_arrays2._ +//> using file compile_arrays.sc +import compile_arrays.* def time_needed[T](i: Int, code: => T) = { val start = System.nanoTime() @@ -68,7 +68,7 @@ } // post 2.5.0 ammonite -import os._ +import os.* def compile_to_file(bl: Block, class_name: String) : Unit = @@ -92,10 +92,10 @@ // Grammar Rules for WHILE with arrays //===================================== -//> using dep com.lihaoyi::fastparse:3.0.2 +//> using dep com.lihaoyi::fastparse:3.1.1 -import fastparse._ -import MultiLineWhitespace._ +import fastparse.* +import MultiLineWhitespace.* def lowercase [$ : P] = P( CharIn("a-z") ) def uppercase[$ : P] = P( CharIn("A-Z") ) @@ -249,7 +249,7 @@ val bf_string = bf_str(prog) println(s"BF parsing (program length ${bf_string.length} characters)") val (time, bf_prog) = - time_needed(1, fastparse.parse(bf_string, Stmts(_)).get.value) + time_needed(1, fastparse.parse(bf_string, implicit p => Stmts).get.value) println(s"BF generated WHILE program (needed $time secs for parsing)") compile_and_run(bf_prog, name) }