With apologies to Robert Pirsig:

Is it a language, or an operating system, or a virtual machine?

Mu.

Read these first: problem statement, readme and installation instructions (mu requires minimal dependencies).

Mu's code looks quite alien, requiring editors to be specially configured to colorize it in a sane manner. So this page provides links to the source files showing how it currently looks in my custom setup.

Whetting your appetite: some example programs.

Part I: basic infrastructure

000organization.cc: the basic skeleton program. Compiles and runs but doesn't do much. Later layers hook into this skeleton to add functionality. Mu's guarantee: you can load features up until any layer, and it will compile and pass all tests until that point. More details →
001help.cc: just a simple test layer to show how to hook into the skeleton. Also summarizes how to invoke mu, behaviors that later layers will be providing.
002test.cc: mu's minimalist test harness, relying on a couple of one-liners in the makefile to autogenerate lists of tests to run.
003trace.cc: support for logging facts about our program, and for checking the facts logged in tests. (tests for the test harness)

Part II: the mu virtual machine, designed to compile easily to machine language.

010vm.cc: core data structures: recipes (functions), instructions and reagents (operands).
011load.cc: the textual representation of recipes and how it's turned into the data structures.
012transform.cc: after mu programs are loaded but before they are run they can be transformed in an extensible manner akin to lisp macros. Think of this as the core of mu's ‘compiler’ for providing high-level features atop the core.
013literal_string.cc: extend the loader to support literal strings in various instructions.
014literal_noninteger.cc: extend the loader to support non-integer numbers.
020run.cc: executing mu recipes by executing the list of instructions they contain.
Various primitive operations: on numbers, booleans, for control flow, and comparing values.
Primitive operations to help with testing: tracing/logging, assert and debug by print.
030container.cc: compound types akin to records, structs or classes.
031address.cc: adding and removing layers of indirection to mu data.
032array.cc: all mu data structures are bounds-checked.
034exclusive_container.cc: tagged unions or sum types.
035call.cc: calls to recipes look just like primitive operations.
036call_ingredient.cc: how recipes pass arguments or 'ingredients' without introducing any syntax and breaking the metaphor of recipes as lists of instructions.
037call_reply.cc: recipes can return arbitrary numbers of values to their callers.
038scheduler.cc: running multiple recipes concurrently using routines that might execute in interleaved fashion.
039wait.cc: primitives for synchronization between routines.

Part III: transforms to provide 80% of the benefits of high-level languages.
040brace.cc: how mu provides structured goto-less programming without introducing the syntax of conditionals and loops other languages require.
041name.cc: how mu transforms variable names to raw memory addresses.
042new.cc: rudimentary memory allocator that is aware of all global types in any mu program.
043space.cc: how variables in different routines are isolated from each other using spaces. Mu ‘local variables’ are allocated on the heap.
044space_surround.cc: Chaining spaces together to accomodate variables with varying lifetimes and ownership properties.
045closure_name.cc: how spaces can implement lexical scope.
046tangle.cc: support for layers in mu programs. They've been so good to us.
047jump_label.cc: since we have
048call_variable.cc: higher-order functions.
049continuation.cc: first-class and delimited continuations, primitives for yield, exceptions and much else besides.
050scenario.cc: mu's first syntax — not for code but for tests. (example)

Part IV: beginnings of a standard library

060string.mu: bounds-checked rather than null-terminated. Unicode-aware.
061channel.mu: channels are mu's only synchronization primitive, queues that can cause the routine reading or writing from them to stall without taking up CPU resources.
062array.mu
063list.mu
064random.cc

Part V: Nascent tools for browsing mu codebases, and for teaching programming to non-programmers by getting them hooked on the value of tests. The eventual goal is an environment that watches the programmers try out the code they write, and turns the interactive sessions into reproducible test scenarios.

070display.cc: primitives for using the keyboard and screen.
071print.mu: helpers that can swap the real screen with fake ones for testing.
072scenario_screen.cc: writing tests that check what is printed to screen. (examples)
074keyboard.mu: helpers that can swap the real keyboard with fake ones for testing.
075scenario_keyboard.cc: writing tests using a fake keyboard. (examples)
077trace_browser.cc: a zoomable UI for inspecting traces generated by mu programs. Allows both scanning a high-level view and drilling down into selective details.

Epilogue: maps summarizing various address spaces, and the conventions that regulate their use in previous layers.


The zen of mu:

Mu's vision of utopia: