solutions/cw3/parser.sc
changeset 921 bb54e7aa1a3f
parent 919 53f08d873e09
child 959 64ec1884d860
--- a/solutions/cw3/parser.sc	Tue Sep 19 09:54:41 2023 +0100
+++ b/solutions/cw3/parser.sc	Tue Sep 19 12:56:10 2023 +0100
@@ -245,7 +245,7 @@
 def eval(bl: Block) : Env = eval_bl(bl, Map())
 
 @main
-def main(file: String) = {
+def run(file: String) = {
   val contents = os.read(os.pwd / file)
   println(s"Lex $file: ")
   println(tokenise(contents))
@@ -255,6 +255,15 @@
   println(eval(Stmts.parse_all(tokenise(contents)).head))
 }
 
+@main
+def test(file: String) = {
+  val contents = os.read(os.pwd / file)
+  println(s"Lex $file: ")
+  println(tokenise(contents))
+  println(s"Parse $file: ")
+  println(Stmts.parse_all(tokenise(contents)).head)
+}
+
 /*
 println("Loops eval")
 val start = System.nanoTime()