On a lark I implemented it in recursive style, but I'm not going to keep
it that way. I have to implement next_term() first and then I'll
uncomment i_joy_combinator().
I'm pretty happy with this. It's iterative rather than recursive so you
won't blow out the call stack if you want to parse a million brackets
(intermediate results are stored on (another) little stack.) It scans
the string and builds lists and sublists as it goes, without wasting
cons cells.
So I was memset'ing the hash table and string table /after/ setting up
the left- and right-bracket tokens! So then when I tried to print the
token list and ht_lookup() dutifully set the error code when it couldn't
find the strings in the hash table, the system properly quit printing
and halted. D'oh! That was a subtle one. Obvious in hindsight.
It took all expletive-deleted day but I finally nailed it down. In the
end the last bug was I was decrementing a stack pointer /after/ trying
to load the item at the (empty) top of the stack. Classic.
I still need to make it not re-allocate strings that it has already
interned, but beyond that I think it's fine.
Clunky but now you only have to change the font name four time in one
place rather than N times in N places, eh?
Writing C again for the first time in ages (this and the Joy
interpreter) the using the preprocessor is like stone-age
meta-programming, from the lens of lisp it's like, "you do what to your
source code?".
It's easy enough to substitute a different font in the call to
Imagemagick's `convert` tool, but in the case of pixel fonts, it will
scale them, so you're not getting a proper bitmap of the pixels, you're
getting a kind of screenshot of the pixels.
I want to make a different machinery for bitmapped pixel fonts, and I
want to make a simple DEFINE-based way to pick them without having to
edit your source code, e.g. #define font_data font_PublicPixel_22_data
yeah?
After that, simple affine transforms for fake 3D..