A simple implementation of a deterministic finite state machine in C#