416 println("derivative size: "+ size(derc)); |
416 println("derivative size: "+ size(derc)); |
417 val v = print_lexer(derc, cs); |
417 val v = print_lexer(derc, cs); |
418 println("Injection!");println("r: "+r); println("c: "+c); println("v:"+v); |
418 println("Injection!");println("r: "+r); println("c: "+c); println("v:"+v); |
419 inj(r, c, v ) } |
419 inj(r, c, v ) } |
420 } |
420 } |
421 val r = STAR("a"|"aa") ~ ("c") |
421 //val r = STAR("a"|"aa") ~ ("c") |
422 println("unsimplified lexer's intermediate derivative sizes:") |
422 //println("unsimplified lexer's intermediate derivative sizes:") |
423 val v = print_lexer(r, "aac".toList) |
423 //val v = print_lexer(r, "aac".toList) |
424 println("simplified lexer's intermediate derivative sizes:") |
424 //println("simplified lexer's intermediate derivative sizes:") |
425 val v2 = simp_lexer(r, "aac".toList) |
425 //val v2 = simp_lexer(r, "aac".toList) |
426 //println(v) |
426 //println(v) |
427 |
427 |
428 // some "rectification" functions for simplification |
428 // some "rectification" functions for simplification |
429 |
429 |
430 |
430 |
1220 |
1220 |
1221 // 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)) |
1221 // 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)) |
1222 // 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)) |
1222 // 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)) |
1223 |
1223 |
1224 |
1224 |
1225 //def time[R](block: => R): R = { |
1225 def time[R](block: => R): R = { |
1226 // val t0 = System.nanoTime() |
1226 val t0 = System.nanoTime() |
1227 // val result = block // call-by-name |
1227 val result = block // call-by-name |
1228 // val t1 = System.nanoTime() |
1228 val t1 = System.nanoTime() |
1229 // println(" " + (t1 - t0)/1e9 + "") |
1229 println(" " + (t1 - t0)/1e9 + "") |
1230 // result |
1230 result |
1231 //} |
1231 } |
1232 val astarstarB = STAR(STAR("a"))~("b") |
1232 val astarstarB = STAR(STAR("a"))~("b") |
1233 val data_points_x_axis = List.range(0, 60000, 3000) |
1233 val data_points_x_axis = List.range(0, 40, 1) |
1234 //for (i <- data_points_x_axis) {print(i); time { blexing(astarstarB, ("a"*i)) } } |
1234 for (i <- data_points_x_axis) {print(i); time { blexing_simp(astarstarB, ("a"*i)) } } |
1235 ////println(data_points_x_axis.zip( List(0,1,3,4))) |
1235 ////println(data_points_x_axis.zip( List(0,1,3,4))) |
1236 //for(i <- List.range(0, 40000, 3000)) print(i + " ") |
1236 //for(i <- List.range(0, 40000, 3000)) print(i + " ") |
1237 |
1237 |
1238 //for (i <- data_points_x_axis) {print(i); time { simp_lexer(astarstarB, ("a"*i).toList) } } |
1238 //for (i <- data_points_x_axis) {print(i); time { simp_lexer(astarstarB, ("a"*i).toList) } } |