progs/re1.scala
changeset 563 6bb70f562d37
parent 556 4b0fffaef849
child 586 9cb8dfcb7f30
equal deleted inserted replaced
562:6705725c0f1a 563:6bb70f562d37
   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