*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 @vertigo

· · Web · 2 · 2 · 2

How SubX code has evolved over the past year

2018/Jul/30: mastodon.social/@akkartik/1004

2019/Sep/03: akkartik.name/images/20190903-

The first thing that pops out is that lines have gotten narrower.

Or have they? Scroll down and some long lines start to show up. Even if you ignore trailing comments. Check out the screenshot. Lines wider than 80 characters translate to 2-byte jump instructions. I wonder if I've lost my sense of proportion somewhere along the way.

@rain @vertigo

Show thread

*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 @vertigo

Show thread

*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 @vertigo

Show thread

Stick *that* in your company's 80-columns max coding conventions and smoke it!! 😜

Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!