RegexExplosionPlot/injToSimp.sc
changeset 668 3831621d7b14
parent 667 660cf698eb26
--- a/RegexExplosionPlot/injToSimp.sc	Tue Jul 25 17:28:29 2023 +0100
+++ b/RegexExplosionPlot/injToSimp.sc	Wed Aug 23 03:02:31 2023 +0100
@@ -418,11 +418,11 @@
     println("Injection!");println("r: "+r); println("c: "+c); println("v:"+v); 
     inj(r, c, v ) }
 }
-val r = STAR("a"|"aa") ~ ("c")
-println("unsimplified lexer's intermediate derivative sizes:")
-val v = print_lexer(r, "aac".toList)
-println("simplified lexer's intermediate derivative sizes:")
-val v2 = simp_lexer(r, "aac".toList)
+//val r = STAR("a"|"aa") ~ ("c")
+//println("unsimplified lexer's intermediate derivative sizes:")
+//val v = print_lexer(r, "aac".toList)
+//println("simplified lexer's intermediate derivative sizes:")
+//val v2 = simp_lexer(r, "aac".toList)
 //println(v)
 
 // some "rectification" functions for simplification
@@ -1222,16 +1222,16 @@
 // Sequ(Sequ(Sequ(Empty,Chr(b)),Stars(List(Chr(b), Chr(b)))),Sequ(Right(Stars(List(Right(Sequ(Sequ(Stars(List(Right(Chr(a)), Right(Chr(a)))),Sequ(Chr(a),Sequ(Left(Chr(b)),Sequ(Empty,Chr(b))))),Empty)), Right(Sequ(Sequ(Stars(List(Right(Chr(a)), Right(Chr(a)))),Sequ(Chr(a),Sequ(Left(Chr(b)),Sequ(Empty,Chr(b))))),Empty))))),Empty))
 
 
-//def time[R](block: => R): R = {
-//    val t0 = System.nanoTime()
-//    val result = block    // call-by-name
-//    val t1 = System.nanoTime()
-//    println(" " + (t1 - t0)/1e9 + "")
-//    result
-//}
+def time[R](block: => R): R = {
+    val t0 = System.nanoTime()
+    val result = block    // call-by-name
+    val t1 = System.nanoTime()
+    println(" " + (t1 - t0)/1e9 + "")
+    result
+}
 val astarstarB  = STAR(STAR("a"))~("b")
-val data_points_x_axis = List.range(0, 60000, 3000)
-//for (i <- data_points_x_axis) {print(i); time { blexing(astarstarB, ("a"*i)) } }
+val data_points_x_axis = List.range(0, 40, 1)
+for (i <- data_points_x_axis) {print(i); time { blexing_simp(astarstarB, ("a"*i)) } }
 ////println(data_points_x_axis.zip( List(0,1,3,4)))
 //for(i <- List.range(0, 40000, 3000)) print(i + " ")