progs/while-arrays/compile_arrays.sc
changeset 975 ae5c03560d4d
parent 974 0cb4bf2469d1
equal deleted inserted replaced
974:0cb4bf2469d1 975:ae5c03560d4d
   219 
   219 
   220 // automating the above
   220 // automating the above
   221 
   221 
   222 import os.*
   222 import os.*
   223 
   223 
   224 def compile_to_file(bl: Block, class_name: String) : Unit = 
   224 def compile_to_file(bl: Block, class_name: String) : Unit = {
   225   write.over(pwd / s"$class_name.j", compile(bl, class_name))  
   225   write.over(pwd / s"$class_name.j", compile(bl, class_name))
       
   226 }    
   226 
   227 
   227 def compile_and_run(bl: Block, class_name: String) : Unit = {
   228 def compile_and_run(bl: Block, class_name: String) : Unit = {
   228   println(s"Start of compilation")
   229   println(s"Start of compilation")
   229   compile_to_file(bl, class_name)
   230   compile_to_file(bl, class_name)
   230   println(s"generated $class_name.j file")
   231   println(s"generated $class_name.j file")