equal
deleted
inserted
replaced
221 case rs => AALTS(bs1, rs) |
221 case rs => AALTS(bs1, rs) |
222 } |
222 } |
223 case r => r |
223 case r => r |
224 } |
224 } |
225 |
225 |
|
226 def bders_simp(r: ARexp, s: List[Char]) : ARexp = s match { |
|
227 case Nil => r |
|
228 case c::cs => bders_simp(bsimp(bder(c, r)), cs) |
|
229 } |
|
230 |
226 def blex_simp(r: ARexp, s: List[Char]) : Bits = s match { |
231 def blex_simp(r: ARexp, s: List[Char]) : Bits = s match { |
227 case Nil => if (bnullable(r)) bmkeps(r) |
232 case Nil => if (bnullable(r)) bmkeps(r) |
228 else throw new Exception("Not matched") |
233 else throw new Exception("Not matched") |
229 case c::cs => blex_simp(bsimp(bder(c, r)), cs) |
234 case c::cs => blex_simp(bsimp(bder(c, r)), cs) |
230 } |
235 } |
366 println(blexing_simp(WHILE_REGS, prog2).filter(s => s == "" || !s.startsWith("w"))) |
371 println(blexing_simp(WHILE_REGS, prog2).filter(s => s == "" || !s.startsWith("w"))) |
367 |
372 |
368 val n = 200 |
373 val n = 200 |
369 println(s"lexing fib program ($n times, size ${prog2.length * n})") |
374 println(s"lexing fib program ($n times, size ${prog2.length * n})") |
370 println(time_needed(1, blexing_simp(WHILE_REGS, prog2 * n))) |
375 println(time_needed(1, blexing_simp(WHILE_REGS, prog2 * n))) |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 val reg2 = STAR("a" | "aa") |
|
382 |
|
383 println(bsize(bders_simp(internalise(reg2), ("a" * 0).toList))) |
|
384 println(bsize(bders_simp(internalise(reg2), ("a" * 1).toList))) |
|
385 println(bsize(bders_simp(internalise(reg2), ("a" * 2).toList))) |
|
386 println(bsize(bders_simp(internalise(reg2), ("a" * 3).toList))) |
|
387 println(bsize(bders_simp(internalise(reg2), ("a" * 4).toList))) |
|
388 println(bsize(bders_simp(internalise(reg2), ("a" * 5).toList))) |