14 Regular Expression Observers
Predicate for regular expressions.
procedure
r : regexp
Predicate for the empty regular expression.
procedure
r : regexp
Predicate for a singleton regular expression.
procedure
r : regexp
Predicate for a union regular expression.
procedure
r : regexp
Predicate for a concat regular expression.
procedure
r : regexp
Predicate for a Kleene star regular expression.
Converts the given regular expression to a string.
procedure
(singleton-regexp-a r) → string
r : singelton-regexp
Extracts the string in the given singleton-regexp.
procedure
(union-regexp-r1 r) → regexp
r : union-regexp
Extracts the first regular expression in the given union-regexp.
procedure
(union-regexp-r2 r) → regexp
r : union-regexp
Extracts the second regular expression in the given union-regexp.
procedure
(concat-regexp-r1 r) → regexp
r : concat-regexp
Extracts the first regular expression in the given concat-regexp.
procedure
(concat-regexp-r2 r) → regexp
r : concat-regexp
Extracts the second regular expression in the given concat-regexp.
procedure
(kleenestar-regexp-r1 r) → regexp
r : kleenestar-regexp
Extracts the regular expression in the given kleenestar-regexp.
Nondeterministically generate a word in the language
of the given regexp. The maximum nuber of repetitions
for a Kleene star is the the optional natural number if provided.
Otherwise, it is 20.
procedure
r : concat-regexp f : (regexp --> word) n : natnum
Generate a word by concatenating words generated
from the sub regular expressions in the given concat-regexp
using the given word-generating function. The given natnum
is used to limit the number of repetitions generated for
nested Kleene star regular expressions (if any).
Generate a word in the language of the given Kleene star
regular expression using the given word-generation function.
The number of concatenated words generated using r is in [0..n+1].
Extract all the nested concatenated sub-regexps in the given
concat-regexp. This includes any nested concat-regexps in r.
Extract all the nested unioned sub-regexps in the given
union-regexp. This includes any nested union-regexps in r.
procedure
(pick-regexp r) → regexp
r : union-regexp
Nondeterministically return a nested sub-regexp from the
given union-regexp. This includes any nested union-regexps
in r.
procedure
n : natural?
Nondeterministically return a natural number in [0..n].
Convert the given singleton-regexp to a word of length 1
containing r’s nested symbol or number.