Exercise 30. Finite State Machines

Whenever you read a book on parsing there’s this scary chapter on finite state machines (FSMs). They go into great detail of “edges” and “nodes” with every combination of possible “automata” being converted into other automata and frankly it’s a bit much. There’s a simpler explanation of FSMs that makes them practical and understandable while not violating the purist theoretical version of the same topic. Sure, you won’t get a paper submitted to the ACM, because you don’t know all of the mathematics behind FSM, but if you just want to use them in your applications then they are simple enough.

An FSM is a way to organize events happening to a set of states. Another way to define an event is an “input trigger,” ...

Get Learn More Python 3 the Hard Way: The Next Step for New Python Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.