--- a/progs/re4.scala Mon Aug 22 09:14:22 2016 +0200
+++ b/progs/re4.scala Mon Aug 22 23:05:43 2016 +0200
@@ -85,18 +85,9 @@
}
-def ders2 (s: List[Char], r: Rexp) : Rexp = (s, r) match {
- case (Nil, r) => r
- case (s, ZERO) => ZERO
- case (s, ONE) => if (s == Nil) ONE else ZERO
- case (s, CHAR(c)) => if (s == List(c)) ONE else
- if (s == Nil) CHAR(c) else ZERO
- case (s, ALT(r1, r2)) => ALT(ders2(s, r2), ders2(s, r2))
- case (c::s, r) => ders2(s, der(c, r).simp)
-}
// main matcher function
-def matcher(r: Rexp, s: String) : Boolean = nullable(ders2(s.toList, r))
+def matcher(r: Rexp, s: String) : Boolean = nullable(ders(s.toList, r))
//one or zero
@@ -119,7 +110,7 @@
// println(i + " " + "%.5f".format(time_needed(10, matcher(EVIL1(i), "a" * i))))
//}
-for (i <- 1 to 6000000 by 500000) {
+for (i <- 1 to 6000001 by 500000) {
println(i + " " + "%.5f".format(time_needed(10, matcher(EVIL2, "a" * i))))
}