Set::FA - Set class for finite automata
use Set::FA; my $set = Set::FA->new(@evenlist);
This module provides an interface by which sets of different finite automata can be constructed. Normal FA execution, stepwise execution, and acceptance tests can be performed for each FA on a single input. The sets can also be manipulated with standard set operations or manipulated by state or arbitrary identifier.
Constructs a new Set::FA object. LIST is an optional list of Set::FA::Element object references.
Adds elements to the set. Adding the same object multiple times will result in a single addition. The actual number of elements inserted is returned.
Return true if all the objects in list are members of the set. LIST may be empty, in which case true is returned.
Return a list of object references for the members of the set.
Returns a subset of the members of the set that have SCALAR as an id.
Return the number of elements in the set.
Remove objects from the set. Removing the same object more than once, or removing an object absent from the set is not an error. Returns the number of elements that were actually removed.
Empty the set.
Return a clone of the set. All references (except for code references) in the new set point to newly created objects.
Return a textual Smalltalk-ish representation of the set.
Also available as overloaded operator "".
Return a new set containing the intersection of the sets passed as arguments.
Also available as overloaded operator *.
Return a new set containing the union of the sets passed as arguments.
Also available as overloaded operator +.
Return true if this set is a subset of SET.
Also available as operator <=.
Return true if this set is a proper subset of SET.
Also available as operator <.
Return true if this set is a superset of SET.
Also available as operator >=.
Return true if this set is a proper superset of SET.
Also available as operator >.
Returns a subset containing the member elements that move to an accepting state on the given INPUT. All members of the superset are advanced using INPUT, regardless of whether they accept INPUT.
Executes all members of the set on INPUT.
Returns a subset containing all memebers of the set that are in an accepting state.
Returns a subset containing all members of the set that are currently in state STATE.
Initializes all members to the start state.
Executes a single step on INPUT, unconsumed output is lost.
None by default.
At this time, only Set::FA::Element objects are supported as members. In the future, I plan to add support for FA::Simple objects, as well as nondeterministic FA.
Mark Rogaski, <email@example.com>
Many thanks to Philip Gwyn for first suggesting the ideas that led to this module, even though I don't think I quite answered his original question ... Leolo++.
For a thorough discussion of finite automata and related topics, I recommend:
Cohen, Daniel I.A., "Introduction to Computer Theory", John Wiley & Sons, Inc. 1991. ISBN 0-471-51010-6.