--- a/compile.scala Wed Nov 28 08:28:26 2012 +0000
+++ b/compile.scala Mon Dec 03 15:35:27 2012 +0000
@@ -1,7 +1,7 @@
// A parser and evaluator for teh while language
//
-//:load matcher.scala
-//:load parser3.scala
+import matcher._
+import parser._
// some regular expressions
val SYM = RANGE("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz_")
@@ -32,7 +32,7 @@
case class T_NUM(s: String) extends Token
case class T_KWD(s: String) extends Token
-val lexing_rules: List[Rule[Token]] =
+val lexing_rules: List[(Rexp, List[Char] => Token)] =
List((KEYWORD, (s) => T_KWD(s.mkString)),
(ID, (s) => T_ID(s.mkString)),
(OP, (s) => T_OP(s.mkString)),
@@ -260,7 +260,7 @@
//examples
-//compile_to("loops.while", "loops.j")
+compile_to("loops.while", "loops.j")
//compile_to("fib.while", "fib.j")
@@ -315,7 +315,7 @@
-// javabyte code assmbler
+// Javabyte code assmbler
//
// java -jar jvm/jasmin-2.4/jasmin.jar loops.j
@@ -324,4 +324,3 @@
-