--- a/solutions/cw3/lexer.sc Sun Sep 17 19:12:57 2023 +0100
+++ b/solutions/cw3/lexer.sc Tue Sep 19 09:54:41 2023 +0100
@@ -1,5 +1,6 @@
-import scala.language.implicitConversions
-import scala.language.reflectiveCalls
+// Lexer from CW2
+//================
+
// Rexp
abstract class Rexp
@@ -27,7 +28,7 @@
case class Rec(x: String, v: Val) extends Val
-// Convenience typing
+// Convenience for typing
def charlist2rexp(s : List[Char]): Rexp = s match {
case Nil => ONE
case c::Nil => CHAR(c)
@@ -136,7 +137,7 @@
case (RANGE(_), Empty) => Chr(c)
case (PLUS(r), Sequ(v1, Stars(vs))) => Stars(inj(r, c, v1)::vs)
- case (OPTIONAL(r), Left(v1)) => Stars(List(inj(r, c, v1)))
+ case (OPTIONAL(r), v1) => Stars(List(inj(r, c, v1)))
case (NTIMES(r, n), Sequ(v1, Stars(vs))) => Stars(inj(r, c, v1)::vs)
}