progs/re1.scala
changeset 422 5deefcc8cffa
parent 415 4ae59fd3b174
child 424 1129024b26d5
equal deleted inserted replaced
417:e74c696821a2 422:5deefcc8cffa
    54   case n => SEQ(r, NTIMES(r, n - 1))
    54   case n => SEQ(r, NTIMES(r, n - 1))
    55 }
    55 }
    56 
    56 
    57 // the evil regular expression  a?{n} a{n}
    57 // the evil regular expression  a?{n} a{n}
    58 def EVIL1(n: Int) = SEQ(NTIMES(OPT(CHAR('a')), n), NTIMES(CHAR('a'), n))
    58 def EVIL1(n: Int) = SEQ(NTIMES(OPT(CHAR('a')), n), NTIMES(CHAR('a'), n))
       
    59 
       
    60 // the evil regular expression (a*)*b
    59 val EVIL2 = SEQ(STAR(CHAR('a')), CHAR('b'))
    61 val EVIL2 = SEQ(STAR(CHAR('a')), CHAR('b'))
    60 
    62 
    61 //for measuring time
    63 //for measuring time
    62 def time_needed[T](i: Int, code: => T) = {
    64 def time_needed[T](i: Int, code: => T) = {
    63   val start = System.nanoTime()
    65   val start = System.nanoTime()