SubX now supports code in multiple files. Segments with the same name get merged.
One subtlety: later code is *prepended* to earlier code. Gives us executable libraries with overrideable entrypoints.
$ git clone https://github.com/akkartik/mu
$ cd mu/subx
$ ./subx translate *.subx -o out
$ ./out # run tests
$ ./subx translate *.subx apps/factorial.subx -o out
$ ./out; echo $?
120 # factorial(5)
$ ./out test # run tests
https://github.com/akkartik/mu/blob/29ab43973a/subx/Readme.md
We also now have the ability to allocate new segments in virtual memory using mmap()
. The first new segment I plan on is a 'trace' segment that tests can write to and make assertions on. Automated white-box testing.
Next up, once I have some tracing primitives: a dependency-injected interface for sockets so that we can write automated tests for a fake network.
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.