SubX now has a test harness, and support for string literals.
Current (increasingly silly) factorial program to compare with the parent toot: http://akkartik.name/images/20180923-subx-factorial.html
Two new features:
a) Autogenerated `run_tests` (line 26) which calls all functions starting with 'test_'.
b) String literals (line 31). They get transparently moved to the data segment and replaced with their address.
https://github.com/akkartik/mu/blob/37d53a709/subx/Readme.md
There's only one problem: I don't know how to build a compiler. Not really. And definitely not in machine code. So I'm going to be fumbling around for a bit. Lots more wrong turns in my future.
I've been trying to port the Crenshaw compiler to SubX. With tests. It's been slow going, because I have to think about how to make Crenshaw's primitives like Error()
and Abort()
testable.
I don't know if just learning to build a compiler will sustain my motivation, though. So some other ideas:
a) Some sort of idealized register allocator in Python or something. I've never built one, and my intuitions on how hard it is seem off.
b) Port Mu's fake screen/keyboard to SubX so that I can reimplement https://github.com/akkartik/mu/tree/master/edit#readme. It was just too sluggish since Mu was interpreted. Even my 12-year-old students quickly dropped it in favor of Vim.
This post is part of my Freewheeling Apps Devlog.
Comments gratefully appreciated. Please send them to me by any method of your choice and I'll include them here.