progs/fun/fun.sc
changeset 869 81ee93b87258
parent 814 1fbaa5f05516
child 870 739039774cee
equal deleted inserted replaced
868:8fb3b6d3be70 869:81ee93b87258
   164   val instructions = prog.map(compile_decl).mkString
   164   val instructions = prog.map(compile_decl).mkString
   165   (library + instructions).replaceAllLiterally("XXX", class_name)
   165   (library + instructions).replaceAllLiterally("XXX", class_name)
   166 }
   166 }
   167 
   167 
   168 
   168 
   169 import ammonite.ops._
   169 // pre-2.5.0 ammonite 
       
   170 // import ammonite.ops._
       
   171 
       
   172 // post 2.5.0 ammonite
       
   173 import $ivy.`com.lihaoyi::os-lib:0.8.0` 
       
   174 import os._
   170 
   175 
   171 def compile_to_file(prog: List[Decl], class_name: String) : Unit = 
   176 def compile_to_file(prog: List[Decl], class_name: String) : Unit = 
   172   write.over(pwd / s"$class_name.j", compile(prog, class_name))  
   177   write.over(pwd / s"$class_name.j", compile(prog, class_name))  
   173 
   178 
   174 def compile_and_run(prog: List[Decl], class_name: String) : Unit = {
   179 def compile_and_run(prog: List[Decl], class_name: String) : Unit = {