diff -r 8bdc44963c0c -r 2151c77e1e24 progs/re.scala --- a/progs/re.scala Thu Nov 17 16:21:56 2016 +0000 +++ b/progs/re.scala Fri Nov 18 18:47:02 2016 +0000 @@ -6,8 +6,6 @@ case class ALT(r1: Rexp, r2: Rexp) extends Rexp case class SEQ(r1: Rexp, r2: Rexp) extends Rexp case class STAR(r: Rexp) extends Rexp -case class NTIMES(r: Rexp, n: Int) extends Rexp -case class UPNTIMES(r: Rexp, n: Int) extends Rexp // nullable function: tests whether the regular // expression can recognise the empty string @@ -18,8 +16,6 @@ case ALT(r1, r2) => nullable(r1) || nullable(r2) case SEQ(r1, r2) => nullable(r1) && nullable(r2) case STAR(_) => true - case NTIMES(r, i) => if (i == 0) true else nullable(r) - case UPNTIMES(r: Rexp, n: Int) => true } // derivative of a regular expression w.r.t. a character @@ -32,13 +28,6 @@ if (nullable(r1)) ALT(SEQ(der(c, r1), r2), der(c, r2)) else SEQ(der(c, r1), r2) case STAR(r1) => SEQ(der(c, r1), STAR(r1)) - case NTIMES(r1, i) => - if (i == 0) ZERO else - if (nullable(r1)) SEQ(der(c, r1), UPNTIMES(r1, i - 1)) - else SEQ(der(c, r1), NTIMES(r1, i - 1)) - case UPNTIMES(r1, i) => - if (i == 0) ZERO - else SEQ(der(c, r1), UPNTIMES(r1, i - 1)) } def simp(r: Rexp) : Rexp = r match {