|
|
@ -47,19 +47,19 @@
|
|
|
|
(list r1))
|
|
|
|
(list r1))
|
|
|
|
((get-char-groups (->re `(concatenation ,e ,r2) c) #f)
|
|
|
|
((get-char-groups (->re `(concatenation ,e ,r2) c) #f)
|
|
|
|
(list r2))
|
|
|
|
(list r2))
|
|
|
|
((get-char-groups (->re `(concatenation (repeat 0 +inf.0 ,r1) ,r2) c) #f)
|
|
|
|
((get-char-groups (->re `(concatenation (repetition 0 +inf.0 ,r1) ,r2) c) #f)
|
|
|
|
(list r1 r2))
|
|
|
|
(list r1 r2))
|
|
|
|
((get-char-groups (->re `(repeat 0 +inf.0 ,r1) c) #f)
|
|
|
|
((get-char-groups (->re `(repetition 0 +inf.0 ,r1) c) #f)
|
|
|
|
(list r1))
|
|
|
|
(list r1))
|
|
|
|
((get-char-groups
|
|
|
|
((get-char-groups
|
|
|
|
(->re `(union (repeat 0 +inf.0 ,r1)
|
|
|
|
(->re `(union (repetition 0 +inf.0 ,r1)
|
|
|
|
(concatenation (repeat 0 +inf.0 ,r2) "3") "4") c) #f)
|
|
|
|
(concatenation (repetition 0 +inf.0 ,r2) "3") "4") c) #f)
|
|
|
|
(list r1 r2 (->re "3" c) (->re "4" c)))
|
|
|
|
(list r1 r2 (->re "3" c) (->re "4" c)))
|
|
|
|
((get-char-groups (->re `(complement ,r1) c) #f)
|
|
|
|
((get-char-groups (->re `(complement ,r1) c) #f)
|
|
|
|
(list all-chars r1))
|
|
|
|
(list all-chars r1))
|
|
|
|
((get-char-groups
|
|
|
|
((get-char-groups
|
|
|
|
(->re `(intersection (repeat 0 +inf.0 ,r1)
|
|
|
|
(->re `(intersection (repetition 0 +inf.0 ,r1)
|
|
|
|
(concatenation (repeat 0 +inf.0 ,r2) "3") "4") c) #f)
|
|
|
|
(concatenation (repetition 0 +inf.0 ,r2) "3") "4") c) #f)
|
|
|
|
(list r1 r2 (->re "3" c) (->re "4" c)))
|
|
|
|
(list r1 r2 (->re "3" c) (->re "4" c)))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(define loc:member? is:member?)
|
|
|
|
(define loc:member? is:member?)
|
|
|
@ -98,10 +98,10 @@
|
|
|
|
(a (char->integer #\a))
|
|
|
|
(a (char->integer #\a))
|
|
|
|
(b (char->integer #\b))
|
|
|
|
(b (char->integer #\b))
|
|
|
|
(r1 (->re #\a c))
|
|
|
|
(r1 (->re #\a c))
|
|
|
|
(r2 (->re `(repeat 0 +inf.0 #\a) c))
|
|
|
|
(r2 (->re `(repetition 0 +inf.0 #\a) c))
|
|
|
|
(r3 (->re `(repeat 0 +inf.0 ,r2) c))
|
|
|
|
(r3 (->re `(repetition 0 +inf.0 ,r2) c))
|
|
|
|
(r4 (->re `(concatenation #\a ,r2) c))
|
|
|
|
(r4 (->re `(concatenation #\a ,r2) c))
|
|
|
|
(r5 (->re `(repeat 0 +inf.0 ,r4) c))
|
|
|
|
(r5 (->re `(repetition 0 +inf.0 ,r4) c))
|
|
|
|
(r6 (->re `(union ,r5 #\a) c))
|
|
|
|
(r6 (->re `(union ,r5 #\a) c))
|
|
|
|
(r7 (->re `(concatenation ,r2 ,r2) c))
|
|
|
|
(r7 (->re `(concatenation ,r2 ,r2) c))
|
|
|
|
(r8 (->re `(complement ,r4) c))
|
|
|
|
(r8 (->re `(complement ,r4) c))
|
|
|
@ -126,8 +126,8 @@
|
|
|
|
((deriveR r8 b c) (->re `(complement ,z) c))
|
|
|
|
((deriveR r8 b c) (->re `(complement ,z) c))
|
|
|
|
((deriveR r9 a c) r2)
|
|
|
|
((deriveR r9 a c) r2)
|
|
|
|
((deriveR r9 b c) z)
|
|
|
|
((deriveR r9 b c) z)
|
|
|
|
((deriveR (->re `(repeat 1 2 "ab") c) a c)
|
|
|
|
((deriveR (->re `(repetition 1 2 "ab") c) a c)
|
|
|
|
(->re `(concatenation "b" (repeat 0 1 "ab")) c)))
|
|
|
|
(->re `(concatenation "b" (repetition 0 1 "ab")) c)))
|
|
|
|
|
|
|
|
|
|
|
|
;; An re-action is (cons re action)
|
|
|
|
;; An re-action is (cons re action)
|
|
|
|
|
|
|
|
|
|
|
@ -172,9 +172,9 @@
|
|
|
|
((derive a (c->i #\b) c) (list (cons z 1) (cons e 2)))
|
|
|
|
((derive a (c->i #\b) c) (list (cons z 1) (cons e 2)))
|
|
|
|
((derive a (c->i #\c) c) #f)
|
|
|
|
((derive a (c->i #\c) c) #f)
|
|
|
|
((derive (list (cons (->re `(union " " "\n" ",") c) 1)
|
|
|
|
((derive (list (cons (->re `(union " " "\n" ",") c) 1)
|
|
|
|
(cons (->re `(concatenation (repeat 0 1 "-")
|
|
|
|
(cons (->re `(concatenation (repetition 0 1 "-")
|
|
|
|
(repeat 1 +inf.0 (char-range "0" "9"))) c) 2)
|
|
|
|
(repetition 1 +inf.0 (char-range "0" "9"))) c) 2)
|
|
|
|
(cons (->re `(concatenation "-" (repeat 1 +inf.0 "-")) c) 3)
|
|
|
|
(cons (->re `(concatenation "-" (repetition 1 +inf.0 "-")) c) 3)
|
|
|
|
(cons (->re "[" c) 4)
|
|
|
|
(cons (->re "[" c) 4)
|
|
|
|
(cons (->re "]" c) 5)) (c->i #\[) c)
|
|
|
|
(cons (->re "]" c) 5)) (c->i #\[) c)
|
|
|
|
b)
|
|
|
|
b)
|
|
|
@ -304,36 +304,36 @@
|
|
|
|
(define t1 (build-test-dfa null))
|
|
|
|
(define t1 (build-test-dfa null))
|
|
|
|
(define t2 (build-test-dfa `(#\a)))
|
|
|
|
(define t2 (build-test-dfa `(#\a)))
|
|
|
|
(define t3 (build-test-dfa `(#\a #\b)))
|
|
|
|
(define t3 (build-test-dfa `(#\a #\b)))
|
|
|
|
(define t4 (build-test-dfa `((repeat 0 +inf.0 #\a)
|
|
|
|
(define t4 (build-test-dfa `((repetition 0 +inf.0 #\a)
|
|
|
|
(repeat 0 +inf.0 (concatenation #\a #\b)))))
|
|
|
|
(repetition 0 +inf.0 (concatenation #\a #\b)))))
|
|
|
|
(define t5 (build-test-dfa `((concatenation (repeat 0 +inf.0 (union #\0 #\1)) #\1))))
|
|
|
|
(define t5 (build-test-dfa `((concatenation (repetition 0 +inf.0 (union #\0 #\1)) #\1))))
|
|
|
|
(define t6 (build-test-dfa `((repeat 0 +inf.0 (repeat 0 +inf.0 #\a))
|
|
|
|
(define t6 (build-test-dfa `((repetition 0 +inf.0 (repetition 0 +inf.0 #\a))
|
|
|
|
(repeat 0 +inf.0 (concatenation #\b (repeat 1 +inf.0 #\b))))))
|
|
|
|
(repetition 0 +inf.0 (concatenation #\b (repetition 1 +inf.0 #\b))))))
|
|
|
|
(define t7 (build-test-dfa `((concatenation (repeat 0 +inf.0 #\a) (repeat 0 +inf.0 #\b)
|
|
|
|
(define t7 (build-test-dfa `((concatenation (repetition 0 +inf.0 #\a) (repetition 0 +inf.0 #\b)
|
|
|
|
(repeat 0 +inf.0 #\c) (repeat 0 +inf.0 #\d)
|
|
|
|
(repetition 0 +inf.0 #\c) (repetition 0 +inf.0 #\d)
|
|
|
|
(repeat 0 +inf.0 #\e)))))
|
|
|
|
(repetition 0 +inf.0 #\e)))))
|
|
|
|
(define t8
|
|
|
|
(define t8
|
|
|
|
(build-test-dfa `((concatenation (repeat 0 +inf.0 (union #\a #\b)) #\a (union #\a #\b)
|
|
|
|
(build-test-dfa `((concatenation (repetition 0 +inf.0 (union #\a #\b)) #\a (union #\a #\b)
|
|
|
|
(union #\a #\b) (union #\a #\b) (union #\a #\b)))))
|
|
|
|
(union #\a #\b) (union #\a #\b) (union #\a #\b)))))
|
|
|
|
(define t9 (build-test-dfa `((concatenation "/*"
|
|
|
|
(define t9 (build-test-dfa `((concatenation "/*"
|
|
|
|
(complement (concatenation (intersection) "*/" (intersection)))
|
|
|
|
(complement (concatenation (intersection) "*/" (intersection)))
|
|
|
|
"*/"))))
|
|
|
|
"*/"))))
|
|
|
|
(define t11 (build-test-dfa `((complement "1"))))
|
|
|
|
(define t11 (build-test-dfa `((complement "1"))))
|
|
|
|
(define t12 (build-test-dfa `((concatenation (intersection (concatenation (repeat 0 +inf.0 "a") "b")
|
|
|
|
(define t12 (build-test-dfa `((concatenation (intersection (concatenation (repetition 0 +inf.0 "a") "b")
|
|
|
|
(concatenation "a" (repeat 0 +inf.0 "b")))
|
|
|
|
(concatenation "a" (repetition 0 +inf.0 "b")))
|
|
|
|
"ab"))))
|
|
|
|
"ab"))))
|
|
|
|
(define x (build-test-dfa `((union " " "\n" ",")
|
|
|
|
(define x (build-test-dfa `((union " " "\n" ",")
|
|
|
|
(concatenation (repeat 0 1 "-") (repeat 1 +inf.0 (char-range "0" "9")))
|
|
|
|
(concatenation (repetition 0 1 "-") (repetition 1 +inf.0 (char-range "0" "9")))
|
|
|
|
(concatenation "-" (repeat 1 +inf.0 "-"))
|
|
|
|
(concatenation "-" (repetition 1 +inf.0 "-"))
|
|
|
|
"["
|
|
|
|
"["
|
|
|
|
"]")))
|
|
|
|
"]")))
|
|
|
|
(define y (build-test-dfa
|
|
|
|
(define y (build-test-dfa
|
|
|
|
`((repeat 1 +inf.0
|
|
|
|
`((repetition 1 +inf.0
|
|
|
|
(union (concatenation "|" (repeat 0 +inf.0 (char-complement "|")) "|")
|
|
|
|
(union (concatenation "|" (repetition 0 +inf.0 (char-complement "|")) "|")
|
|
|
|
(concatenation "|" (repeat 0 +inf.0 (char-complement "|"))))))))
|
|
|
|
(concatenation "|" (repetition 0 +inf.0 (char-complement "|"))))))))
|
|
|
|
(define t13 (build-test-dfa `((intersection (concatenation (intersection) "111" (intersection))
|
|
|
|
(define t13 (build-test-dfa `((intersection (concatenation (intersection) "111" (intersection))
|
|
|
|
(complement (union (concatenation (intersection) "01")
|
|
|
|
(complement (union (concatenation (intersection) "01")
|
|
|
|
(repeat 1 +inf.0 "1")))))))
|
|
|
|
(repetition 1 +inf.0 "1")))))))
|
|
|
|
(define t14 (build-test-dfa `((complement "1"))))
|
|
|
|
(define t14 (build-test-dfa `((complement "1"))))
|
|
|
|
|#
|
|
|
|
|#
|
|
|
|
)
|
|
|
|
)
|