progs/cw1.scala
changeset 550 71fc4a7a7039
parent 547 81eb43c41416
child 586 451a95e1bc25
equal deleted inserted replaced
549:352d15782d35 550:71fc4a7a7039
   230 TEST("/", COMMENT3)
   230 TEST("/", COMMENT3)
   231 TEST("/f", COMMENT3)
   231 TEST("/f", COMMENT3)
   232 TEST("/f&", COMMENT3)
   232 TEST("/f&", COMMENT3)
   233 TEST("/f& ", COMMENT3)
   233 TEST("/f& ", COMMENT3)
   234 
   234 
   235 
       
   236 
       
   237 //test: ("a" | "aa") ~ ("a" | "aa")*
   235 //test: ("a" | "aa") ~ ("a" | "aa")*
   238 for (i <- 1 to 100 by 1) {
       
   239   println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL3, "a" * i))) + " size: " + size(ders(("a" * i).toList, EVIL3)))
       
   240 }
       
   241 
       
   242 val auxEVIL3 = ALT(CHAR('a'), SEQ(CHAR('a'), CHAR('a')))
   236 val auxEVIL3 = ALT(CHAR('a'), SEQ(CHAR('a'), CHAR('a')))
   243 val EVIL3 = SEQ(auxEVIL3, STAR(auxEVIL3))
   237 val EVIL3 = SEQ(auxEVIL3, STAR(auxEVIL3))
   244 val EVIL3p = FROMNTIMES(auxEVIL3, 1)
   238 val EVIL3p = FROMNTIMES(auxEVIL3, 1)
       
   239 
       
   240 
       
   241 for (i <- 1 to 100 by 1) {
       
   242   println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL3, "a" * i))) + " size: " + 
       
   243 	  size(ders(("a" * i).toList, EVIL3)))
       
   244 }
       
   245 
       
   246 
   245 
   247 
   246 val t1 = EVIL3
   248 val t1 = EVIL3
   247 val t2 = simp(der('a', t1))
   249 val t2 = simp(der('a', t1))
   248 val t3 = simp(der('a', t2))
   250 val t3 = simp(der('a', t2))
   249 val t4 = simp(der('a', t3))
   251 val t4 = simp(der('a', t3))