A loop and a data structure to hold the result of parsing. The data structure will have a state you can interrogate. No need to build a state machine to explicitly name each way the parsing can develop.
I think of a state machine as a hardware concept, not software. If all these conditions, transition to state 21. Then do a thing, if these conditions, transition to 38.
as someone who would also reach for a state machine when doing simple parsing… what’s the better alternative in python?
A loop and a data structure to hold the result of parsing. The data structure will have a state you can interrogate. No need to build a state machine to explicitly name each way the parsing can develop.
that’s what I’d do for a state machine implementation too
I think of a state machine as a hardware concept, not software. If all these conditions, transition to state 21. Then do a thing, if these conditions, transition to 38.