progs/fun/funt.sc
changeset 901 01b481e47887
parent 870 1ea379515c6d
child 955 ca67172b8fa1
equal deleted inserted replaced
900:3a03dbedec91 901:01b481e47887
       
     1 
     1 // A Small Compiler for a Simple Functional Language
     2 // A Small Compiler for a Simple Functional Language
     2 //  - includes a lexer and a parser
     3 //  - includes a lexer and a parser
     3 //  - performs tail-call optimisations
     4 //  - performs tail-call optimisations
     4 //
     5 //
     5 // call with
     6 // call with
   163 
   164 
   164 // pre-2.5.0 ammonite 
   165 // pre-2.5.0 ammonite 
   165 // import ammonite.ops._
   166 // import ammonite.ops._
   166 
   167 
   167 // post 2.5.0 ammonite
   168 // post 2.5.0 ammonite
   168 // import os._
   169 import os._
   169 
   170 
   170 def compile_to_file(prog: List[Decl], class_name: String) : Unit = 
   171 def compile_to_file(prog: List[Decl], class_name: String) : Unit = 
   171   write.over(pwd / s"$class_name.j", compile(prog, class_name))  
   172   write.over(pwd / s"$class_name.j", compile(prog, class_name))  
   172 
   173 
   173 def compile_and_run(prog: List[Decl], class_name: String) : Unit = {
   174 def compile_and_run(prog: List[Decl], class_name: String) : Unit = {