10 points Rochus 3 days ago 7 comments

I have been developing Micron (for "MicroOberon"), a lean, statically typed, modular systems programming language that combines Oberon’s simplicity and explicit module structure with C’s low-level capabilities and interoperability.

Micron is not my first langage design. I first built Oberon+, a modernized and unified Oberon, in order to under­ stand, by implementing it and by porting real systems to it, what Wirth’s design actually gives and where it fails. The systems ported to Oberon+ included the 2013 Project Oberon System and different versions of Oberon System 3. I then explored the opposite direction with Luon, a higher-level language for managed application progamming. Micron is the synthesis of this and my 30 years experience with C/C++ in systems programming.

The goal of Micron is to use the same language for boot code, device drivers, an operating system kernel, and ordinary applications, without requiring a garbage collector or routing machine access through a separate, unchecked system dialect (such as Oberon's SYSTEM.ADR/GET/PUT which operates on LONGINT). The language supports explicit memory layouts, signed and unsigned integer types, pointer operations, and direct calls to C without wrappers. One of its central design choices is language levels. Each module declars the level and thus the feature it needs, ranging from code that requires neither stack nor heap to garbage-collected objects. A module can import only modules at the same or a lower level. For example, a kernel module declared at level 1 cannot accidentally acquire a dependency on heap allocation through an import. Other features include generic modules, structural interfaces, and compile-time procedures. Much of what would require a preprocessor in C is expressed through typed language features.

There is a working compiler, interpreter, and IDE, along with a free textbook (http://software.rochus-keller.ch/micron-textbook.pdf). The book explains both how the language works and the reasons behind its design. Its systems-programming section walks through a port of Wirth and Gutknecht’s Project Oberon operating system to Micron, cross-compiled and linked into a single executabl that runs on an emulated RISC-V machine.

The examples also include ports of a Smalltalk-80 VM, Scheme 9, and the original P4 Pascal compiler. The compiler and interpreter implement the language specification; native backends and tooling are still work in progress, and the current native code generation prioritises simplicity over optimisation.

For more information see https://github.com/rochus-keller/Micron/blob/master/Readme.m....

andsoitis 3 days ago | parent

Congratulations!

I've always been super interested in Oberon (due to my Pascal / Object Pascal / Delphi heritage) and even tried things like A2 (https://en.wikipedia.org/wiki/A2_(operating_system)) but never fully got into the boat.

Micron makes me excited to try your latest incarnation.

Rochus 3 days ago | parent

Thanks. I also spent significant time with ActiveOberon (https://github.com/rochus-keller/activeoberon/) and AOS/Bluebottle (the 2004 version of A2, see https://github.com/rochus-keller/activeobjectsystem), but it turned out to be much more difficult to migrate to multiboot than the Oberon system. Micron is supposed to replace assembler even in lowest level when there is no stack with dedicated language levels and full type-checking support. Working system examples are here: https://github.com/rochus-keller/OberonSystem/tree/micron-rv... and https://github.com/rochus-keller/micronsystem3/.

andsoitis 3 days ago | parent

Love the examples you've implemented in Micron:

The examples subdirectory (https://github.com/rochus-keller/Micron/tree/master/examples) contains:

  - a Smalltalk-80 implementation,
  - the original 1976 P4 Pascal compiler,
  - the Scheme 9 virtual machine,
  - the Project Oberon System running on the host,
  - and the Micron System described in the textbook, the migrated Project Oberon System natively running on RISC-V.*

Rochus 3 days ago | parent

The idea was to migrate representative C, C++, Pascal and Oberon implementations to Micron to see whether the language is descriptive and practical enough, and indeed I made a lot of language changes because of this experience.

berkeleynerd 3 days ago | parent

Would be great to see Micron up on Rosetta with a good selection of examples ported there. Great work...will definitely be having a look!

Rochus 3 days ago | parent

Thanks. I made a kind of my own Rosetta project here: https://github.com/rochus-keller/are-we-fast-yet/

HexDecOctBin 6 minutes ago | parent

It seems like the language requires Pascal/C89 style declarations on top of the scope. I've never been sure why Pascal developers have stuck to this convention for so long. Is it the zeal to preserve single-pass compilation?