Getting Started with Oberon

Oberon-07

I am interested in cheap ways to increase the quality of software development. One good way is formal proof, e.g. seL4, CompCert, CakeML. I'm curious if there's another way, to keep the software simple enough that code review is good enough. With this in mind, I enjoyed the 2013 revision of Wirth's “Project Oberon”. Here I try to use the minimal Oberon language for some “programming in the large” tasks.

First, you'll need to install an Oberon compiler. I can recommend the following ways:

Oberon-2

There is also a good implementation of Oberon-2 called voc which is great for UNIX or Windows Services for Linux (and maybe Win32/Win64) but you may not want to start with this. There are some small incompatibilities that are easy to work around once you know what you're doing, but until then…

For example, here is a trivial module in Oberon-07. And here is a port to voc. Note the following differences:

  • Oberon-2 (which is implemented by voc) has the concept of type inclusion. Oberon-07 requires calling FLT and FLOOR.
  • Oberon-07 allows calling any public PROCEDURE with M2. voc targets UNIX programs, so you need to call the right PROCEDURE from the module's BEGIN block instead

That is only for this trivial example. There are several other incompatabilities. None of them are difficult to work around, but to start with I'd recommend limiting yourself to Oberon-07. As is often the case when choosing programming languages, it's largely a matter of taste, but I think I prefer Oberon-07. So even when I use voc (it seems to be the best compiler for UNIX) I eschew the Oberon-2 features. And unless stated otherwise, all sample code here is in Oberon-07.