progs/app6.scala
changeset 399 5c1fbb39c93e
parent 343 539b2e88f5b9
child 412 1cef3924f7a2
--- a/progs/app6.scala	Tue Mar 22 17:09:24 2016 +0000
+++ b/progs/app6.scala	Wed Apr 06 11:51:33 2016 +0100
@@ -1,17 +1,17 @@
 def simp(r: Rexp): Rexp = r match {
   case ALT(r1, r2) => {
     (simp(r1), simp(r2)) match {
-      case (NULL, r2s) => r2s
-      case (r1s, NULL) => r1s
+      case (ZERO, r2s) => r2s
+      case (r1s, ZERO) => r1s
       case (r1s, r2s) => if (r1s == r2s) r1s else ALT(r1s, r2s)
     }
   }
   case SEQ(r1, r2) => {
     (simp(r1), simp(r2)) match {
-      case (NULL, _) => NULL
-      case (_, NULL) => NULL
-      case (EMPTY, r2s) => r2s
-      case (r1s, EMPTY) => r1s
+      case (ZERO, _) => ZERO
+      case (_, ZERO) => ZERO
+      case (ONE, r2s) => r2s
+      case (r1s, ONE) => r1s
       case (r1s, r2s) => SEQ(r1s, r2s)
     }
   }
@@ -21,6 +21,6 @@
 
 def ders (s: List[Char], r: Rexp) : Rexp = s match {
   case Nil => r
-  case c::s => ders(s, simp(der(c, r)))
+  case c::s => ders(s, simp(der(c, r))) (*@\label{simpline}@*) 
 }