diff -r 4d787a8b79a6 -r a8a0f5f1cb75 progs/while-arrays/compile_arrays2.sc --- a/progs/while-arrays/compile_arrays2.sc Sun Oct 29 13:05:09 2023 +0000 +++ b/progs/while-arrays/compile_arrays2.sc Mon Oct 30 12:58:45 2023 +0000 @@ -13,6 +13,8 @@ // the abstract syntax trees for WHILE +//> using toolkit latest + abstract class Stmt abstract class AExp abstract class BExp @@ -147,7 +149,7 @@ case Skip => ("", env) case Assign(x, a) => { val index = env.getOrElse(x, env.keys.size) - (compile_aexp(a, env) ++ compile_istore(index), env + (x -> index)) + (compile_aexp(a, env) ++ compile_istore(index), env + (x -> index)) } case If(b, bl1, bl2) => { val if_else = Fresh("If_else") @@ -244,7 +246,7 @@ def compile_to_file(bl: Block, class_name: String) : Unit = - write.over(pwd / s"$class_name.j", compile(bl, class_name)) + os.write.over(os.pwd / s"$class_name.j", compile(bl, class_name)) def compile_and_run(bl: Block, class_name: String) : Unit = { println(s"Start of compilation") @@ -259,9 +261,9 @@ -@main def main() = { - compile_and_run(array_test, "arr") -} +//@main def main() = { +// compile_and_run(array_test, "arr") +//}