In the first two parts of this series I’ve introduced state engines and taken apart a specific instance of an engine. Now it’s time to tie together the design idea with approaches to building a variety of such engines.
Because the programming logic is in the state table, the engine can be fairly generic. That means it’s possible to create a state engine framework you can reuse for a variety of applications.
Last time I introduced state engines and state tables. I showed parts of a simple implementation of one in Python. It parsed the language introduced in Little Programming Languages. This post continues that, so be sure you’ve read that first article.
I got as far as the state table implementing the process, and that’s where this post picks up. I’ll also get into the
SourceReader class that does the heavy lifting.
One of the cool things about being a carpenter is that you can make your own shelves and dog houses. One of the cool things about being a computer programmer is that you can make your own computer apps!
In an era when computers are so much a part of life, that’s a useful skill. And the nice thing about doing it yourself is that things turn out exactly as you want them. You can make things that are perfect just for you.
Case in point: using Python to create custom charts of baseball stats!