A library for constructing finite state machines