logoalt Hacker News

Show HN: Micron – Oberon with the Power of C

26 points • by Rochus • last Sunday at 1:40 PM • 8 comments • view on HN

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....


Comments

andsoitis • last Sunday at 2:02 PM

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.*
➕ show 1 reply
berkeleynerd • last Sunday at 2:40 PM

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!

➕ show 1 reply
HexDecOctBin • today at 6:14 PM

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?

➕ show 1 reply
andsoitis • last Sunday at 1:58 PM

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.

➕ show 1 reply