3 ms·
FWIW, here's an example I wrote in Python "that imitates what “compiled” FSM code might look like in an “unrolled” form. Most FSM code uses a little driver loop
by carapace 6y ago
FWIW, here's an example I wrote in Python "that imitates what “compiled” FSM code might look like in an “unrolled” form. Most FSM code uses a little driver loop and a table datastructure, the code below instead acts like JMP instructions (“jump”, or GOTO in higher-level-but-still-low-level languages) to hard-code the information in the table into a little patch of branches."
https://joypy.osdn.io/notebooks/Derivatives_of_Regular_Expressions.html#drive-a-fsm https://joypy.osdn.io/notebooks/Derivatives_of_Regular_Expre...
It's part of an (incomplete. slightly broken) notebook on Brzozowski’s derivatives of regular expressions.