progs/re1.scala
changeset 563 bddf14e026b3
parent 556 40e22ad45744
child 586 451a95e1bc25
equal deleted inserted replaced
562:fa6d00968b0e 563:bddf14e026b3
   129 
   129 
   130 // given a regular expression and building successive
   130 // given a regular expression and building successive
   131 // derivatives might result into bigger and bigger
   131 // derivatives might result into bigger and bigger
   132 // regular expressions...here is an example for this:
   132 // regular expressions...here is an example for this:
   133 
   133 
       
   134 // (a+b)* o a o b o (a+b)*
   134 val BIG_aux = STAR(ALT(CHAR('a'), CHAR('b')))
   135 val BIG_aux = STAR(ALT(CHAR('a'), CHAR('b')))
   135 val BIG = SEQ(BIG_aux, SEQ(CHAR('a'),SEQ(CHAR('b'), BIG_aux)))
   136 val BIG = SEQ(BIG_aux, SEQ(CHAR('a'),SEQ(CHAR('b'), BIG_aux)))
   136 
   137 
   137 size(ders("".toList, BIG))              // 13
   138 size(ders("".toList, BIG))              // 13
   138 size(ders("ab".toList, BIG))            // 51
   139 size(ders("ab".toList, BIG))            // 51