Compile-time finite state machine