Why not use mutual recursion and TCO? The function with the program counter is the current state. Problem solved?
Mutable state is your enemy...
Mutable state is your enemy...
Also: While mutable state is problematic, sometimes the alternatives are worse.
The lack of TCO or ability to do mutual recursion+TCO is really the fault of the language. If you have a state machine with a small number (<20) states, mutual recursion seems like a more natural fit (unless you have to have states determined at run-time).