Finite state machine generator