Does anyone have any examples of finite state machines implemented in Zig?
I am considering using GitHub - cryptocode/zigfsm: A finite state machine library for Zig but I don’t know if its worth taking on a dependency yet.
Does anyone have any examples of finite state machines implemented in Zig?
I am considering using GitHub - cryptocode/zigfsm: A finite state machine library for Zig but I don’t know if its worth taking on a dependency yet.
The Zig tokenizer:
mvzr is a finite state machine implemented as a VM. It’s an FSM despite that, because there are no jump instructions, so no loops are possible. Not all state transitions are stored explicitly, some of them exist on the user stack. Depending on what you intend to model, and other program logic needs (i.e. do you need to save out a complete state), this can be a flexible way to do it.