*Update on the Mu computer's memory-safe language*
I wrote about it last week at http://akkartik.name/post/mu-2019-2, but already that post is growing out of date. Here's an initial sketch: http://akkartik.github.io/mu/html/apps/mu.subx.html
So far all that works is function definitions with no arguments or body. They emit just the prologue and epilogue code sequences.
But I have a sketch of the next few steps of the design in there.
The design in http://akkartik.name/post/mu-2019-2 has changed in 2 ways.
#1: no more uninitialized variables. There's just no safe way to avoid initialization when structs can contain pointers.
This adds overheads to local variables in two ways: performance, and translator complexity for length-prefixed arrays. We can't just zero out everything, we also have to write array lengths in. Since structs may contain arrays, initializing a variable may involve writing lengths to multiple locations.
#2: unwinding the stack when exiting a scope. I can't just increment the stack pointer, I need to also restore any necessary registers along the way.
Another complication is that I need Java's labeled `break`s: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/branch.html. Since `break` does double-duty for both conditionals and loops, it's too onerous to only be able to `break` out of one scope at a time. But labeled `break`s increase the frequency with which I need to unwind the stack. More overhead.
The common theme here seems to be that the translator needs to maintain 'symbolic' representations of contiguous memory regions, tracking either values or register bindings for offsets.
I'm not sure how I feel about these choices. Perhaps I should give up on this whole design and switch to something more traditional. A memory-safe C-like language. So I'd love to hear feedback and suggestions, either here or over email: ak@akkartik.com
Project link: https://github.com/akkartik/mu#readme
cc @vertigo @rain@niu.moe
*Update on the Mu computer's memory-safe language*
First statements now translating!
http://akkartik.github.io/mu/html/apps/mu.subx.html
`fn foo {}` => function prologue and epilogue
`increment x` when x is on the stack.
`foo x` when x is on the stack and foo is a user-defined function.
Seems like small progress, but.. http://rampantgames.com/blog/?p=7745
I feel like I'm finally starting to get closure on https://news.ycombinator.com/item?id=13608810#13610366
(Project page: https://github.com/akkartik/mu#readme)
@vertigo @rain@niu.moe
*Update on the Mu computer's memory-safe language*
In the last 2 weeks I went from being able to translate:
```
fn foo {
}
```
to:
```
fn foo n: int {
increment n
}
```
That required 2k LoC. So it seems fair to say that things are still in the "black triangles" phase. And there are still gaping holes. Variable declarations don't really exist yet. (I can just parse them.)
(Project page: https://github.com/akkartik/mu#readme)