--- a/progs/re3a.scala Tue Oct 18 20:39:54 2016 +0100
+++ b/progs/re3a.scala Wed Oct 19 08:46:50 2016 +0100
@@ -35,7 +35,7 @@
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))
+ 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))
@@ -68,7 +68,6 @@
// main matcher function
def matcher(r: Rexp, s: String) : Boolean = nullable(ders(s.toList, r))
-
//one or zero
def OPT(r: Rexp) = ALT(r, ONE)