For a friend’s birthday a year ago, I gave them a NACLO-style linguistics puzzle for a programming language that I invented (I could’ve made the puzzle an already-made language, but I didn’t want there to be an urge to look for documentation online). I’ve made a slightly modified version of the puzzle public here.
Anyway, the interpreter I made wasn’t good. It was very slow, and I don’t really understand the theory behind lexers, parsers, and compilers, despite Crafting Interpreters being on my to-read list for a while.
Note: There are spoilers below.
The core inspiration for the language itself was trying to make
control-flow constructs like loops, conditionals, and functions emergent
rather than built-in (like how
else if in C is not built-in, but
rather a combination of
if). This was done by treating
blocks as first-class objects. For example, a
repeat loop can achieved
by multiplying a block by an integer and then executing it.
If I was to extend this language, I’d make
while loops look nicer and
also allow blocks to take parameters and return values. I’d also make
blocks have their own scope and selectively capture values.