*Update on the Mu computer*

Now that we have a bootstrapped (quasi-) language[1] and (kinda) bootstrapped OS[2], we're finally starting to think about less error-prone notations.

This week two of us built a notation for x86 addressing modes:

direct: %ecx
indirect: *ecx
indirect with displacement: *(ecx+4)
indirect with index, scale and displacement: *(ecx + edx<<3 + 4)

Not yet sure this is a good approach. But it'll be fun to playtest.

[1] mastodon.social/@akkartik/1024
[2] mastodon.social/@akkartik/1025

*Update on the Mu computer*

Now that we have a notation for addressing modes, we're designing syntax for function calls.

It's easiest to parse if we start with a paren and avoid commas. However, the similarity to s-expressions is only skin deep. There can only be 2 levels of parens, and args can't do arbitrary arithmetic.

Pseudocode: akkartik.github.io/mu/html/app
Uses the just-created addressing mode notation! (mastodon.social/@akkartik/1026)

More info: github.com/akkartik/mu#readme

@rain@niu.moe @vertigo

*Update on the Mu computer*

Syntax sugar for function calls is done. Here's factorial with no sugar, addressing modes and function calls, respectively.

Time now to start building a proper language, to occupy C's niche on this new stack. Type-safe, memory-safe, manual (but safe) memory management, manual (but safe) register allocation.

Though I might build a toy Lisp first. I figure I've earned some fun. Seeing a computer boot into a REPL would qualify.


@rain@niu.moe @vertigo

*Update on the Mu computer*

We now have structured control flow (with goto statements 😂 )

Compare this screenshot with the ones in the previous message of this thread.

At this point I think I've climbed as far up the ladder of abstractions as I can with just syntax sugar. The next step up will be a new language. It'll still look the same: registers, curly braces, one operation to a line. But operations won't be x86 opcodes anymore. Registers and operands will have types.

@rain@niu.moe @vertigo

· · Web · 0 · 1 · 2
Sign in to participate in the conversation

The original server operated by the Mastodon gGmbH non-profit