equal
deleted
inserted
replaced
58 def ders (s: List[Char], r: Rexp) : Rexp = s match { |
58 def ders (s: List[Char], r: Rexp) : Rexp = s match { |
59 case Nil => r |
59 case Nil => r |
60 case c::s => ders(s, simp(der(c, r))) |
60 case c::s => ders(s, simp(der(c, r))) |
61 } |
61 } |
62 |
62 |
63 def matcher(r: Rexp, s: String) : Boolean = nullable(ders(s.toList, r)) |
63 def matches(r: Rexp, s: String) : Boolean = nullable(ders(s.toList, r)) |
64 |
64 |
65 |
65 |
66 //one or zero |
66 //one or zero |
67 def OPT(r: Rexp) = ALT(r, EMPTY) |
67 def OPT(r: Rexp) = ALT(r, EMPTY) |
68 |
68 |
75 (end - start)/(i * 1.0e9) |
75 (end - start)/(i * 1.0e9) |
76 } |
76 } |
77 |
77 |
78 |
78 |
79 for (i <- 1 to 12001 by 500) { |
79 for (i <- 1 to 12001 by 500) { |
80 println(i + " " + "%.5f".format(time_needed(1, matcher(EVIL(i), "a" * i)))) |
80 println(i + " " + "%.5f".format(time_needed(1, matches(EVIL(i), "a" * i)))) |
81 } |
81 } |
82 |
82 |
83 |
83 |