*Update on the Mu computer's memory-safe language*
Progress has been slow over the holiday season because I've been working on a paper about Mu for https://2020.programming-conference.org/home/salon-2020
But functions can now return outputs.
```
fn foo a: int -> result/eax: int {
result <- copy a
increment result
}
```
Project page: https://github.com/akkartik/mu#readme
Sources for the memory-safe language, now at 5kLoC: http://akkartik.github.io/mu/html/apps/mu.subx.html
Caveats: no checking yet, only int types supported.
*Update on the Mu computer's memory-safe language*
Still no type-checking or memory-safety, but we can now write any programs with int variables.
There's still no 'var' keyword, so we can't define local variables yet. But that's not insurmountable; just pass in extra arguments for any space you want on the stack 😀
```
result <- factorial n 0 0 0
```
*Update on the Mu computer's memory-safe language*
Basic language is done! Here's factorial. (Compare https://mastodon.social/@akkartik/102749590808384215.)
Still todo:
- user-defined types
- type checking and memory-safety
In other words, I'm about a third of the way there 😂 More detailed todo list: https://lobste.rs/s/pv8jpr/what_are_you_doing_this_week#c_5ymbsa
(More details on the Mu project: http://akkartik.name/post/mu-2019-1. Repo: https://github.com/akkartik/mu)
A brief timeline of the Mu computing stack
Jul 6, 2014: commit 0, tree-based interpreter for a statement-oriented language (https://github.com/akkartik/mu)
Jul 19, 2017: commit 3930, start of SubX machine code (http://akkartik.name/post/mu-2019-1)
Sep 20, 2018: started building SubX in SubX (https://mastodon.social/@akkartik/100779355103829305)
Jul 24, 2019: SubX in SubX done, commit 5461 (https://mastodon.social/@akkartik/102495274992610155)
Oct 2, 2019: started designing the Mu memory-safe language (http://akkartik.name/post/mu-2019-2)
Oct 29: started http://akkartik.github.io/mu/html/apps/mu.subx.html
I'll be in Porto, Portugal on Mar 24 to present a paper on Mu at the Convivial Computing Salon: https://2020.programming-conference.org/home/salon-2020#event-overview
Hoping for some great conversation and disagreements.
*Update on the Mu computer's memory-safe language*
Mu just got its first couple of non-integer types: addresses and arrays. As a result, the factorial app can _finally_ run its tests based on command-line args.
http://akkartik.github.io/mu/html/apps/factorial.mu.html
Addresses are accessed using a '*' operator. Arrays are accessed using an 'index' instruction that takes an address (addr array T) and returns an address (addr T).
Literal indexes aren't supported yet.
Open q: indexing arrays of non-power-of-2 element sizes.
Lots of words in this commit message about liveness analysis, and it probably still makes no sense to anybody.
https://github.com/akkartik/mu/commit/4032286f9bb231139b733e5444b862006d3b9119
Hopefully it'll make sense to me at least in a month or two.
@akkartik But this is the bestest documented machine code ever! That has to count for many more hours than is readily apparent.
New milestone: I just wrote 150 LoC of glorified machine code (utterly unsafe; lots of magic numbers) and had it work the first time.
https://github.com/akkartik/mu/commit/c8784d1c0f0
Though to be fair I'd been planning it for 16 hours, with lots of preliminary commits that nibbled away at the edges of the problem. Still, time spent thinking before rather than debugging after.
Perhaps this is bad news. Perhaps my brain is getting so colonized by machine code that I'm losing my bearings on what is easy for others.