Crafting Interpreters 2020-07-17
(Wow, I totally forgot how I laid out my posts two years ago. Maybe I should bring some of that back, if I settle on a topic schedule.)
Anyway, while I was poking around programming blogs and thinking about stuff to work on, I stumbled back over Crafting Interpreters. Nearly two years ago, I had looked at the instructions for writing an interpreter in Java, and thought "Eh, I'll try it in Lua." That decision was both broadly consistent with my reaction to seemingly every coding tutorial, and led to a bunch of work that I foolishly did not comment.
I see that my last post on the topic had me speculating about targeting RPython for a JIT interpreter. I've thought about such things in the past few years, and I think I'd specifically like to try prototyping in PyPy3, then potentially porting it back to PyPy2, then restricting it to RPython. Each step of that entails giving up developer convenience and writing more code in the hope of increasing execution speed. Either I write simple code now, and gradually replace it with more complicated code, or I try to write the more complicated code all at once, up front. As such, the cost of using Python 3 to start with is, at worst, the up-front cost of the code that will have to be rewritten into a more complicated version later, which is really low, because attrs and enum are great.
I've just basically gotten started with my Python version of Lox, and it's not too impressive yet. I don't know if I'll keep on with this, but switching gears seems to have helped with my stress a bit. Anyway, it's way late now, so I should wrap up.
Good night.