Next: Regular Expression Operators in
Up: Extendible Regular Expression Operators
Previous: New operators in terms
Some operators are more easily defined in terms of the underlying
automaton. For instance, the operator reverse(X) is the set of
all strings Y such that the reversal of Y is in X.
In case the operand X is constructed by means of standard
regular expression operators it would be possible to define the
reverse operator recursively in terms of the various forms that
X can take; in FSA however X could be constructed by means of
various user-defined operators as well. Therefore this approach is not
applicable. However, the operation is trivial to define in terms of
the underlying automaton: each of the transitions needs to be swapped,
final states become start states and vice versa. The (simplified)
definition is given as follows:
![\begin{displaymath}\begin{minipage}[t]{.9\textwidth}\begin{verbatim}rx(reverse...
...)\vert T]) :-
reverse_trans(T0,T).\end{verbatim}\end{minipage}\end{displaymath}](img19.gif) |
(17) |
As is typical in such definitions, the fsa_regex:rx
predicate is used to construct an automaton for a given regular
expression. The fsa_data module provides a
consistent interface to the internal representation of automata.
Its predicates can be
used to select relevant parts of an automaton (such as start
states, final states and transitions) and to construct automata on
the basis of such parts.
Next: Regular Expression Operators in
Up: Extendible Regular Expression Operators
Previous: New operators in terms
2000-07-03