progs/while-arrays/compile_bfc.sc
changeset 869 81ee93b87258
parent 829 dc3c35673e94
child 870 739039774cee
equal deleted inserted replaced
868:8fb3b6d3be70 869:81ee93b87258
    61   val instructions = compile_block(bl, Map())._1
    61   val instructions = compile_block(bl, Map())._1
    62   (beginning ++ instructions ++ ending).replace("XXX", class_name)
    62   (beginning ++ instructions ++ ending).replace("XXX", class_name)
    63 }
    63 }
    64 
    64 
    65 // automating the above
    65 // automating the above
    66 import ammonite.ops._
    66 
       
    67 // pre-2.5.0 ammonite 
       
    68 // import ammonite.ops._
       
    69 
       
    70 // post 2.5.0 ammonite
       
    71 import $ivy.`com.lihaoyi::os-lib:0.8.0` 
       
    72 import os._
       
    73 
    67 
    74 
    68 def compile_to_file(bl: Block, class_name: String) : Unit = 
    75 def compile_to_file(bl: Block, class_name: String) : Unit = 
    69   write.over(pwd / s"$class_name.j", compile(bl, class_name))  
    76   write.over(pwd / s"$class_name.j", compile(bl, class_name))  
    70 
    77 
    71 def compile_and_run(bl: Block, class_name: String) : Unit = {
    78 def compile_and_run(bl: Block, class_name: String) : Unit = {