progs/scala/re-annotated2.sc
changeset 644 9f984ff20020
parent 361 8bb064045b4e
child 645 304a12cdda6f
--- a/progs/scala/re-annotated2.sc	Mon Feb 20 23:40:30 2023 +0000
+++ b/progs/scala/re-annotated2.sc	Thu Feb 23 12:37:34 2023 +0000
@@ -223,6 +223,11 @@
   case r => r
 }
 
+def bders_simp(r: ARexp, s: List[Char]) : ARexp = s match {
+  case Nil => r
+  case c::cs => bders_simp(bsimp(bder(c, r)), cs)
+}
+
 def blex_simp(r: ARexp, s: List[Char]) : Bits = s match {
   case Nil => if (bnullable(r)) bmkeps(r) 
               else throw new Exception("Not matched")
@@ -368,3 +373,16 @@
 val n = 200
 println(s"lexing fib program ($n times, size ${prog2.length * n})")
 println(time_needed(1, blexing_simp(WHILE_REGS, prog2 * n)))
+
+
+
+
+
+val reg2 = STAR("a" | "aa")
+
+println(bsize(bders_simp(internalise(reg2), ("a" * 0).toList)))
+println(bsize(bders_simp(internalise(reg2), ("a" * 1).toList)))
+println(bsize(bders_simp(internalise(reg2), ("a" * 2).toList)))
+println(bsize(bders_simp(internalise(reg2), ("a" * 3).toList)))
+println(bsize(bders_simp(internalise(reg2), ("a" * 4).toList)))
+println(bsize(bders_simp(internalise(reg2), ("a" * 5).toList)))