--- a/progs/matcher/re1.sc Sun Sep 27 09:15:32 2020 +0100
+++ b/progs/matcher/re1.sc Tue Sep 29 00:51:43 2020 +0100
@@ -66,7 +66,7 @@
// the optional regular expression (one or zero times)
-def OPT(r: Rexp) = ALT(r, ONE)
+def OPT(r: Rexp) = ALT(r, ONE) // r + 1
// the n-times regular expression (explicitly expanded)
def NTIMES(r: Rexp, n: Int) : Rexp = n match {
@@ -79,8 +79,9 @@
// Test Cases
//============
-// the evil regular expression a?{n} a{n}
-def EVIL1(n: Int) = SEQ(NTIMES(OPT(CHAR('a')), n), NTIMES(CHAR('a'), n))
+// the evil regular expression (a?){n} a{n}
+def EVIL1(n: Int) =
+ SEQ(NTIMES(OPT(CHAR('a')), n), NTIMES(CHAR('a'), n))
// the evil regular expression (a*)* b
val EVIL2 = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))