Building a disk image before:
./translate_mu_baremetal baremetal/life.mu
After:
./translate life.mu
Building an ELF binary before:
./translate_mu apps/hello.mu
After:
cd linux; ./translate hello.mu
https://github.com/akkartik/mu#readme
https://github.com/akkartik/mu
This was one of the more difficult things I've built, and yet all I've gotten working so far is some rudimentary tokenization. The reason is one little feature.. well, take a look for yourself.
https://archive.org/details/akkartik-2min-2021-02-24 (video; 2 mins)
As always, built all the way up from machine code, and designed primarily to be easy to build, easy to run, comprehensible to others. Also this time with lots of tests.
https://github.com/akkartik/mu
So far I'm done with https://github.com/kanaka/mal/blob/master/process/guide.md#step-0-the-repl, albeit with some tweaks since it's baremetal
https://github.com/akkartik/mu/tree/main/baremetal#readme
The screenshot below shows an idea I've been playing with.
The conventional way Forth does control flow is a little confusing with words like if
and then
showing up at the end.
Factor uses quotations to put code blocks on the stack. But then you see a potentially complex chunk of code executing "all at once".
Main project page: https://github.com/akkartik/mu
https://archive.org/details/akkartik-mu-shell-20210214
Starting point for the sources: http://akkartik.github.io/mu/html/baremetal/shell/line.mu.html
The architecture is now much cleaner. Functions contain lines, lines contain words, words contain gap buffers. Rendering a thing renders its constituent things. Render takes a top-left coordinate and returns a bottom-right coordinate. Each thing knows which constituent thing has its cursor, shows its cursor when rendering, redirects incoming keystrokes to it.
https://github.com/akkartik/mu
https://archive.org/details/akkartik-mu-life-2021-02-13
Sources: http://akkartik.github.io/mu/html/apps/life.mu.html
Main project page: https://github.com/akkartik/mu
Standing offer: I would love to collaborate on a computing stack for a non-English language by forking https://github.com/akkartik/mu. It's very barebones and not afraid of radical experiments. It already has an API for rendering arbitrary UTF-8 strings and returning arbitrarily-sized bounding boxes for what was rendered. So the work is mostly creating glyphs for combinations of codepoints. And rules for segmenting. And lots of testing.
This was hard, purely because of cursor management. I have a greater appreciation for everything that display hardware and terminal emulators provide for text mode. Mu so far puts the onus on the programmer.
http://akkartik.github.io/mu/html/baremetal/rpn.mu.html
In the end it's interesting to visualize the changes I had to make:
vim -d apps/rpn.mu baremetal/rpn.mu
They're entirely in main
; the rest is unchanged.
http://akkartik.github.io/mu/html/baremetal/ex7.mu.html
Play it on any non-windows:
git clone https://github.com/akkartik/mu
cd mu
./translate_mu_baremetal_emulated baremetal/ex7.mu
qemu-system-i386 disk.img
h/j/k/l to draw.
I made an art! On a computer without an OS.