💾 Archived View for sdf.org › rsdoiel › blog › 2020 › 04 › 11 › Mostly-Oberon.gmi captured on 2023-03-20 at 18:50:01. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

Mostly Oberon

By R. S. Doiel, 2020-04-11

Mostly Oberon is a series of blog posts documenting my exploration of the Oberon Language, Oberon System and the various rabbit wholes I inevitably fell into.

Overview

Oberon is a classical computer language and operating system originated by Professors Niklaus Wirth and Jürg Gutknecht at ETH[1] circa 1987. It was inspired by their experiences in California at the Xerox Palo Alto Research Center[2]. This series of blog posts are my meandering exploration of Oberon-07 language based on Project Oberon 2013[3].

1: https://en.wikipedia.org/wiki/ETH_Zurich

2: https://en.wikipedia.org/wiki/PARC_(company)

3: http://www.projectoberon.com/

NOTE: Oberon grew from Wirth's Modula, which grew from Pascal, which grew from his experiences with Algol.

My Voyage

I am new to both Oberon and the Oberon System. Oberon language is in the tradition of ALGOL, Pascal, Modula 1 and 2 as well as incorporating ideas from the parent of Object Oriented languages Simula. The Oberon language reminds me of my first programming language Turbo Pascal[4]. Oberon's language shape is more Pascal than C. For that reason I think it has largely been overlooked.

4: https://en.wikipedia.org/wiki/Turbo_Pascal

Oberon-07 is Wirth's most recent refinement of the Oberon language. It is a terse and powerful systems language. It strikes a different computing path then many popular programming languages used in 2020. You find its influence along with Simula in more recent popular languages like Go[5].

5: https://golang.org

While Wirth conceived of Oberon in the context of a whole system it's use in research and instruction means it is also well suited POSIX[6] based systems (e.g. BSD, Linux, macOS). The difference in programming in Oberon for a POSIX system versus a native Oberon System is primarily in the modules you import. These posts will focus on using Oberon language in a POSIX environment.

6: https://en.wikipedia.org/wiki/POSIX

NOTE: Oberon was initially a project including the CERES Hardware, Oberon compiler and Oberon operating system for networked workstations.

The latest Oberon is Prof. Niklaus Wirth and Paul Reeds' Project Oberon 2013. If you want to explore it I suggest using Peter De Wachter's emulator[7]. Project Oberon also his links to the updated books and articles in PDF format which are easy to read (or print) on most computing devices.

7: https://github.com/pdewacht/oberon-risc-emu

A starting point

I am starting my exploration with Karl Landström's OBNC[8] compiler. I am focusing on getting comfortable using and writing in the Oberon language.

8: https://miasap.se/obnc/

Here's an example of a simple "Hello World" program in Oberon written for a POSIX system. I've named the source code[9] HelloWorld.Mod.

9: HelloWorld.Mod

NOTE: In 2020 common POSIX systems include Linux[10], BSD[11] and macOS[12].

10: https://en.wikipedia.org/wiki/Linux

11: https://en.wikipedia.org/wiki/Berkeley_Software_Distribution

12: https://en.wikipedia.org/wiki/MacOS


    MODULE HelloWorld;
      IMPORT Out;
    BEGIN
      Out.String("Hello World!"); Out.Ln;
    END HelloWorld.

While this is longer than a Python "hello world" program it is much shorter than I remember writing in Java and about the same number of lines as in C. BEGIN and END are similar to our opening and closing curly braces in C and the module is the basic unit of source code in Oberon. IMPORT includes the module Out (modules are similar to a included library in C) for sending values to the console (stdout in POSIX). One thing to note, Oberon language(s) are case sensitive. All language terms are capitalized. This makes it easy to distinguish between source code written in Oberon versus the Oberon language itself.

The Out module includes methods for displaying various data types native to Oberon. There is a corresponding In for receiving input as well as some additional modules provided with our chosen compiler implementation.

Modules in Oberon can include a module wide initialization block. The BEGIN through END HelloWorld. are an initialization block. This is similar to C or Go's "main" function for our POSIX environment.

OBNC

If you want to run my "Hello World" you need to compile it. I have found that OBNC[13] compiler runs well on Linux, macOS and Raspberry Pi[14]. Karl has also made a precompiled version that runs on Windows available too. It is the Oberon compiler I plan to use in this series of posts.

13: https://miasap.se/obnc/

14: https://www.raspberrypi.org

OBNC compiles Oberon source into C then into machine code for the computer system you are running on. Because it is compiling to C it can function as a cross compiler[15]. This opens the door to bare metal programming[16].

15: https://en.wikipedia.org/wiki/Cross_compiler

16: https://en.wikipedia.org/wiki/Bare_machine

If you're following along please install OBNC on your computer. Instructions are found at https://maisap.se/obnc[17]. Karl also has excellent documentation and is responsive to questions about his implementation. His contact methods are included on his website.

17: https://maisap.se/obnc

Running OBNC

OBNC provides a Oberon-07 compiler with some optional modules for working in a POSIX environment. Compiling our "Hello World" is easy from your shell or terminal.


    obnc HelloWorld.Mod

If all goes well this should produce an executable file named HelloWorld (or HelloWorld.exe on Windows). You can now run this program with a command like ./HelloWorld (or HelloWorld on Windows).

Learning more about Oberon

I have faced two challenges in my exploration of Oberon, finding a compiler I was happy with (thank you Karl for OBNC) and sorting out the literature around Oberon language implementations and system versions.

Oberon has a rich history though it was not well known in Southern California in 2020. Oberon's history is primarily academic and European. It was commonly used in college level instruction in Europe from it's inception at ETH in the late 80's through the early 2000s. The Oberon System is an Open Source system (predating the term by a decade) and was created in the spirit of other academic systems such as BSD. There are many books (physical books as opposed to ebooks) dating from that era. They covered the Oberon language and system of their time. From a historical computing perspective they remain very interesting. But running Oberon on modern 2020 hardware is a little more challenging. Fortunately Prof. Emeritus Wirth and Paul Reed brought things up to date in 2013. I recommend Reed's www.projectoberon.com[18] as a good place to start. He includes links to revised versions of the classic Oberon and Oberon System texts written by Wirth et el. Prof. Wirth's website[19] is still maintained and he features links to most of his major publications. His is the canonical source of information on Oberon.

18: http://www.projectoberon.com

19: https://inf.ethz.ch/personal/wirth/

NOTE: Prof. Wirth's personal website at ETH was available as of 2020-04-11.

I have found the ACM Digital Library[20] and the ETH Research Collection[21] very helpful. While much of the material is now historic it remains useful for both techniques and inspiration. Today's hardware, even a Raspberry Pi Zero, is more resource rich than the original systems Oberon ran on.

20: https://dl.acm.org/

21: https://www.research-collection.ethz.ch/?locale-attribute=en

The online community for Oberon and Oberon System seems mostly centered around a mail list[22] at ETH and net news group comp.lang.oberon[23]

22: https://lists.inf.ethz.ch/mailman/listinfo/oberon

23: https://groups.google.com/forum/#!forum/comp.lang.oberon

Next

24: ../12/Mostly-Oberon-Modules.html