You may also install it on RingoJS using the command ringo-admin install aaditmshah/statemachines.
You may install it as a component for web apps using the command component install aaditmshah/statemachines.
A StateMachine is a pattern recognizer. There are two types of state machines - Deterministic and Nondeterministic. Both are equally powerful.
Deterministic state machines are faster. However nondeterministic state machines are easier to create. Fortunately there's a way to create an equivalent deterministic state machine from a nondeterministic one.
Consider the following nondeterministic state machine:
The first parameter to StateMachine.Nondeterministic must be the transition table for the nondeterministic state machine. The second parameter must be list of final or accepting states of the state machine.
The state machine may now be used to test input strings as follows: