updated
authorChristian Urban <urbanc@in.tum.de>
Wed, 13 Mar 2019 12:31:03 +0000
changeset 315 ab7fe342e004
parent 314 20a57552d722
child 316 0eaa1851a5b6
updated
exps/bit.scala
--- a/exps/bit.scala	Wed Mar 13 10:36:29 2019 +0000
+++ b/exps/bit.scala	Wed Mar 13 12:31:03 2019 +0000
@@ -104,6 +104,9 @@
   case RECD(x, r) => s"(${x}! ${string(r)})"
 }
 
+def strings(rs: Set[Rexp]): String =
+  rs.map(string).mkString("{", "|", "}")
+
 // string of an annotated regular expressions - for testing purposes
 
 def astring(a: ARexp): String = a match {
@@ -435,6 +438,8 @@
       case (AZERO, _) => AZERO
       case (_, AZERO) => AZERO
       case (AONE(bs2), r2s) => fuse(bs1 ++ bs2, r2s)
+      //case (AALTS(bs2, rs), r2s) =>  
+      //  AALTS(bs1 ++ bs2, rs.map(ASEQ(Nil, _, r2s)))
       case (r1s, r2s) => ASEQ(bs1, r1s, r2s)
   }
   case AALTS(bs1, rs) => distinctBy(flats(rs.map(bsimp)), erase) match {
@@ -474,6 +479,8 @@
       case (AZERO, _) => AZERO
       case (_, AZERO) => AZERO
       case (AONE(bs2), r2s) => fuse(bs1 ++ bs2, r2s)
+      //case (AALTS(bs2, rs), r2s) =>  
+      //  AALTS(bs1 ++ bs2, rs.map(ASEQ(Nil, _, r2s)))
       case (r1s, r2s) => ASEQ(bs1, r1s, r2s)
   }
   case AALTS(bs1, rs) => distinctBy(flats(rs.map(bsimp_full)), erase) match {
@@ -674,15 +681,23 @@
 
 println("Small tests")
 
-val q = STAR(STAR("bb" | "ab"))
-val qs = "bbb"
+val q = STAR(STAR("bb" | ("a" | "b")))
+val qs = "bb"
 
 println("Size Bit  " + asize(bders_simp(qs.toList, internalise(q))))
 println("Size Bitf " + asize(bders_simp_full(qs.toList, internalise(q))))
 println("Size Bit2 " + asize(bders2_simp(qs.toList, internalise(q))))
 println("Size Old  " + size(ders_simp(qs.toList, q)))
-println("Size Pder " + psize(pders_simp(qs.toList, q)))
+println("Size Pder " + psize(pders(qs.toList, q)))
+println("Size Pder simp " + psize(pders_simp(qs.toList, q)))
 
+println(astring(bders_simp(qs.toList, internalise(q))))
+println(astring(bders_simp_full(qs.toList, internalise(q))))
+println(string(ders_simp(qs.toList, q)))
+println(strings(pders(qs.toList, q)))
+println(strings(pders_simp(qs.toList, q)))
+
+System.exit(0)
 
 val re1 = STAR("a" | "aa")
 println(astring(bders_simp("".toList, internalise(re1))))