Spiral.scala
changeset 3 f15dccc42c7b
parent 2 cf169411b771
child 4 7a349fe58bf4
equal deleted inserted replaced
2:cf169411b771 3:f15dccc42c7b
   287       //therefore able to be spilled in the bspill function
   287       //therefore able to be spilled in the bspill function
   288       val der_res =  brder(all_chars(i), old)
   288       val der_res =  brder(all_chars(i), old)
   289       val simp_res = br_simp(der_res)
   289       val simp_res = br_simp(der_res)
   290       val anatomy = bspill(simp_res)
   290       val anatomy = bspill(simp_res)
   291       //track if the number of regular expressions exceeds those in the PD set(remember PD means the pders over A*)
   291       //track if the number of regular expressions exceeds those in the PD set(remember PD means the pders over A*)
   292       if(f(anatomy, pd)  == false){
   292       if(f(anatomy, pd)  == false || i == 1){
   293         println(size(berase(syncsimp_res)))
   293         println(size(berase(syncsimp_res)))
   294         println(size(berase(simp_res)))
   294         println(size(berase(simp_res)))
       
   295         println(bregx_tree(simp_res))
   295         println(anatomy.map(size).sum)
   296         println(anatomy.map(size).sum)
   296         println(pd.map(size).sum)
   297         println(pd.map(size).sum)
   297       }  
   298       }  
   298       old = simp_res
   299       old = simp_res
   299       syncold = syncsimp_res
   300       syncold = syncsimp_res
   313   def size_expansion_rate(anatomy: List[Rexp], pd: Set[Rexp]): Boolean = if(anatomy.size > (pd.size)*2 ) {println("size of PD and bspilled simp regx: ", pd.size, anatomy.size); inclusion_truth(anatomy, pd); false }else {true}
   314   def size_expansion_rate(anatomy: List[Rexp], pd: Set[Rexp]): Boolean = if(anatomy.size > (pd.size)*2 ) {println("size of PD and bspilled simp regx: ", pd.size, anatomy.size); inclusion_truth(anatomy, pd); false }else {true}
   314   
   315   
   315   def check_all(){
   316   def check_all(){
   316     for(i <- 1 to 1)
   317     for(i <- 1 to 1)
   317     {
   318     {
   318         val s = "bbb"//rd_string_gen(alphabet_size, 5)//"ac"//rd_string_gen(alphabet_size, 5)
   319         val s = "bb"//rd_string_gen(alphabet_size, 5)//"ac"//rd_string_gen(alphabet_size, 5)
   319         val r = STAR(STAR(ALTS(List(SEQ(CHAR('b'),CHAR('b')), ALTS(List(CHAR('a'), CHAR('b')))))))//balanced_struct_gen(4)//SEQ(ALTS(List(STAR("a"),ALTS(List("a","c")))),SEQ(ALTS(List("c","a")),ALTS(List("c","b")))) //random_struct_gen(7)
   320         val r = STAR(STAR(ALTS(List(SEQ(CHAR('b'),CHAR('b')), ALTS(List(CHAR('a'), CHAR('b')))))))//balanced_struct_gen(4)//SEQ(ALTS(List(STAR("a"),ALTS(List("a","c")))),SEQ(ALTS(List("c","a")),ALTS(List("c","b")))) //random_struct_gen(7)
   320         //subset_check(r, s)
   321         //subset_check(r, s)
   321         weak_sub_check(r, s, 5, size_expansion_rate)
   322         weak_sub_check(r, s, 5, size_expansion_rate)
   322     }
   323     }
   323   }
   324   }