Diary 2019-03-08
Things I did today:
- Focused on cleaning up my giant mass of web browser tabs. My laptop should run a lot better now.
- Minecraft after I told myself I wouldn't.
I've also been thinking about implementing interpreters in Python, inspired by considering the tail-call elimination code I wrote, and pondering whether it has any real use. Designing interpreters in general might be useful if I get into the position of both wanting to add scripting to something, and not seeing a good story for embedding an existing language's interpreter.
Considering the hypothetical language as statement-based, with various control flow forms. The basic structure of organization is a "block", which the various control flow forms include. Let's model this at a somewhat low level, and have the concept of a "function", which acts as the root of a tree of goto labels. So, in terms of definition, there are various kinds of statement, each of which can be associated with some number of blocks. Each block contains some number of statements. (It'd probably be really hard to actually use, but I've got a mental image of something partway between Lua and Erlang.) I'm imagining something that could be considered equivalent to a continuation, but it would actually just be pretty much a normal stack: each function call would be a new frame, and entering blocks would add scopes, but leave the frame intact. So, there'd be a pointer within each relevant block of statements, and that would either advance or be replaced with a pointer to an accessible label.
That was fun to work out, but I don't think I have anything new to bring to the table here, so I'll shelve this as well for now, and pick back up game-making tutorials. I think what I'd like to do when I come back to this kind of language messing-around thing is to be articulating hypotheses, and designing stuff to test them. Talking about this reminded me of some old code, and I got distracted staring at it, because it's frankly kind of weird. Oh well, best move on, get sleep. Good night.