equal
deleted
inserted
replaced
29 case SEQ(r1, r2) => |
29 case SEQ(r1, r2) => |
30 if (nullable(r1)) ALT(SEQ(der(c, r1), r2), der(c, r2)) |
30 if (nullable(r1)) ALT(SEQ(der(c, r1), r2), der(c, r2)) |
31 else SEQ(der(c, r1), r2) |
31 else SEQ(der(c, r1), r2) |
32 case STAR(r1) => SEQ(der(c, r1), STAR(r1)) |
32 case STAR(r1) => SEQ(der(c, r1), STAR(r1)) |
33 case NTIMES(r, i) => |
33 case NTIMES(r, i) => |
34 if (i == 0) ZERO else SEQ(der(c, r), NTIMES(r, i - 1)) |
34 if (i == 0) ZERO else der(c, SEQ(r, NTIMES(r, i - 1))) |
35 } |
35 } |
36 |
36 |
37 def simp(r: Rexp) : Rexp = r match { |
37 def simp(r: Rexp) : Rexp = r match { |
38 case ALT(r1, r2) => (simp(r1), simp(r2)) match { |
38 case ALT(r1, r2) => (simp(r1), simp(r2)) match { |
39 case (ZERO, r2s) => r2s |
39 case (ZERO, r2s) => r2s |