class documentation
class Automaton(Generic[
Constructor: Automaton(initial)
A declaration of a finite state machine.
Note that this is not the machine itself; it is immutable.
| Method | __init__ |
Initialize the set of transitions and the initial state. |
| Method | add |
Add the given transition to the outputSymbol. Raise ValueError if there is already a transition with the same inState and inputSymbol. |
| Method | all |
All transitions. |
| Method | initial |
Set this automaton's initial state. Raises a ValueError if this automaton already has an initial state. |
| Method | input |
The full set of symbols acceptable to this automaton. |
| Method | output |
The full set of symbols which can be produced by this automaton. |
| Method | output |
A 2-tuple of (outState, outputSymbols) for inputSymbol. |
| Method | states |
All valid states; "Q" in the mathematical description of a state machine. |
| Method | unhandled |
All unhandled transitions will be handled by transitioning to the given error state and error-handling output symbols. |
| Property | initial |
Return this automaton's initial state. |
| Instance Variable | _initial |
Undocumented |
| Instance Variable | _transitions |
Undocumented |
| Instance Variable | _unhandled |
Undocumented |
def addTransition(self, inState:
State, inputSymbol: Input, outState: State, outputSymbols: tuple[ Output, ...]):
(source)
¶
Add the given transition to the outputSymbol. Raise ValueError if there is already a transition with the same inState and inputSymbol.
Set this automaton's initial state. Raises a ValueError if this automaton already has an initial state.
def outputForInput(self, inState:
State, inputSymbol: Input) -> tuple[ State, Sequence[ Output]]:
(source)
¶
A 2-tuple of (outState, outputSymbols) for inputSymbol.