69 |
69 |
70 // post 2.5.0 ammonite |
70 // post 2.5.0 ammonite |
71 import os.* |
71 import os.* |
72 |
72 |
73 |
73 |
74 def compile_to_file(bl: Block, class_name: String) : Unit = |
74 def compile_to_file(bl: Block, class_name: String) : Unit = { |
75 os.write.over(os.pwd / s"$class_name.j", compile(bl, class_name)) |
75 write.over(pwd / s"$class_name.while", bl.toString) // maybe we should pretty-print the AST |
76 |
76 write.over(pwd / s"$class_name.j", compile(bl, class_name)) |
77 def compile_and_run(bl: Block, class_name: String) : Unit = { |
77 } |
|
78 |
|
79 def compile_and_run(bl: Block, class_name: String) : Unit = { |
78 println(s"Start of compilation") |
80 println(s"Start of compilation") |
79 compile_to_file(bl, class_name) |
81 compile_to_file(bl, class_name) |
80 println(s"generated $class_name.j file") |
82 println(s"generated $class_name.j file") |
81 val (jasmin_time, _) = |
83 val (jasmin_time, _) = |
82 time_needed(1, os.proc("java", "-jar", "jasmin.jar", s"$class_name.j").call()) |
84 time_needed(1, os.proc("java", "-jar", "jasmin.jar", s"$class_name.j").call()) |