lisp-8 with in-game editor

Published 2023-06-12

Here's a silly thing that came out of another thread where I was contemplating parsing game content out of strings, and just how far to take the idea. Eventually configuration/data formats always end up becoming programming languages (heck that's how Lua got its start), so why not just make it a full programming language from the start? Get a jump on Greenspun's 10th rule.

So, I implemented lisp-8, a small lisp dialect intended to be used in pico-8 carts. The core code is about 1400 tokens after some fairly aggressive (ugly) optimizations. I could cut it down by about 200 tokens if pico-8 ever exposed Lua's _G variable.

And of course, once you've got a scripting language embedded in your game, why not allow your players to type in code and make a full programming game out of it?

Of course, it might take a week to type in your program with the limited input available on pico-8. So if you don't want to type in code yourself, hit tab to cycle through some sample lisp statements.


This editor cartridge is, of course, itself implemented in lisp-8. It's all in the first _init function at the top of the code, the rest of the file is the lisp-8 engine.

Ultimately I don't know if this has any practical use at all, and it sure is slow, but it's kind of fun. It gave me lots of good ideas about how I can better compile together my assets for my actual pico-8 programming puzzle game, at least.