--- a/progs/matcher/re3.sc Thu Sep 29 22:07:21 2022 +0100
+++ b/progs/matcher/re3.sc Fri Sep 30 06:03:46 2022 +0100
@@ -186,44 +186,3 @@
def fail() = { test3(); test4() }
-// runs with amm2 and amm3
-
-def pp(r: Rexp): String = r match {
- case SEQ(CHAR(a1), SEQ(r1, r2)) => s"${a1}${pp(r1)}${pp(r2)}"
- case SEQ(ONE, SEQ(r1, r2)) => s"1${pp(r1)}${pp(r2)}"
- case SEQ(ZERO, SEQ(r1, r2)) => s"0${pp(r1)}${pp(r2)}"
- case SEQ(CHAR(a1), CHAR(a2)) => s"${a1}${a2}"
- case SEQ(ONE, CHAR(a2)) => s"1${a2}"
- case SEQ(ZERO, CHAR(a2)) => s"0${a2}"
- case ZERO => "0"
- case ONE => "1"
- case CHAR(a) => a.toString
- case ALT(r1, r2) => s"(${pp(r1)} + ${pp(r2)})"
- case SEQ(r1, r2) => s"(${pp(r1)} o ${pp(r2)})"
- case STAR(r1) => s"(${pp(r1)})*"
-}
-
-
-val REG = STAR(ALT(CHAR('a'), SEQ(CHAR('a'), CHAR('a'))))
-
-print(pp(ders("".toList, REG)))
-print(pp(ders("a".toList, REG)))
-print(pp(ders("aa".toList, REG)))
-print(pp(ders("aaa".toList, REG)))
-
-size(ders("".toList, REG)) // 6
-size(ders("a".toList, REG)) // 12
-size(ders("aa".toList, REG)) // 27
-size(ders("aaa".toList, REG)) // 55
-size(ders("aaaa".toList, REG)) // 8
-size(ders("aaaaa".toList, REG)) // 169
-size(ders("aaaaaa".toList, REG)) // 283
-size(ders(("a" * 7).toList, REG)) // 468
-size(ders(("a" * 8).toList, REG)) // 767
-size(ders(("a" * 9).toList, REG)) // 1251
-size(ders(("a" * 10).toList, REG))// 2034
-size(ders(("a" * 11).toList, REG))// 3301
-
-for (i <- (0 to 40)) {
- println(s"$i:" + size(ders(("a" * i).toList, REG)))
-}
\ No newline at end of file