progs/fun/funt.sc
changeset 901 33cff35bdc1a
parent 870 739039774cee
child 956 ae9782e62bdd
equal deleted inserted replaced
900:3be23d0df3db 901:33cff35bdc1a
       
     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 = {