glint
A tool for finite state machine analysis and synthesis.
...You just tell glint how you would like your control entity to operate and glint returns to you the synthesised magic black box which implements the desired logic.
Also glint can tell you in regexp style which event sequences your FSM can handle and which are forbidden for it.