💾 Archived View for sdf.org › rsdoiel › blog › 2020 › 04 › 11 › Mostly-Oberon.html captured on 2023-06-14 at 14:27:18.
⬅️ Previous capture (2023-03-20)
-=-=-=-=-=-=-
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="language" content="EN"> <title>Mostly-Oberon</title> <link rel="stylesheet" type="text/css" href="/printfonts/print.css" media="print" /> <link rel="stylesheet" type="text/css" href="/webfonts/fonts.css" media="screen" /> <link rel="stylesheet" type="text/css" href="/css/site.css" media="screen" /> <link rel="stylesheet" type="text/css" href="/css/tables.css" media="screen" /> <link title="RSS feed for rsdoiel's blog" rel="alternate" type="application/rss+xml" href="https://rsdoiel.github.io/rss.xml" /> <meta name="keywords" content="Oberon, Wirth, Gutknecht, ETH, Parc, programming, operating systems"> <link rel="alternative" type="application/markdown" href="/blog/2020/04/11/Mostly-Oberon.md"> <link rel="search" type="application/opensearchdescription+xml" title="Robert's Rambling Search Engine" href="search.osdx"> </head> <body> <nav> <ul> <li><a href="/">R. S. Doiel</a></li> <li><a href="/about.html">About</a></li> <li><a href="/blog/">Blog</a></li> <li><a href="/cv.html">CV</a></li> <li><a href="https://github.com/rsdoiel">GitHub</a></li> <li><a href="/library-terminology.html">Library Jargon</a></li> <li><a href="/presentations.html">Presentations</a></li> <li><a href="/projects.html">Projects</a></li> <li><a href="/resume.html">Resume</a></li> <li><a href="/search.html">Search</a></li> <li><a href="/series/">Series</a></li> </ul> </nav> <section> <article> <a data-pocket-label="pocket" data-pocket-count="none" class="pocket-btn" data-lang="en"></a> <script type="text/javascript">!function(d,i){if(!d.getElementById(i)){var j=d.createElement("script");j.id=i;j.src="https://widgets.getpocket.com/v1/j/btn.js?v=1";var w=d.getElementById(i);d.body.appendChild(j);}}(document,"pocket-btn-js");</script> <h1 id="mostly-oberon">Mostly Oberon</h1> <p>By R. S. Doiel, 2020-04-11</p> <p><strong>Mostly Oberon</strong> is a series of blog posts documenting my exploration of the Oberon Language, Oberon System and the various rabbit wholes I inevitably fell into.</p> <h2 id="overview">Overview</h2> <p>Oberon is a classical computer language and operating system originated by Professors Niklaus Wirth and Jürg Gutknecht at <a href="https://en.wikipedia.org/wiki/ETH_Zurich">ETH</a> circa 1987. It was inspired by their experiences in California at the <a href="https://en.wikipedia.org/wiki/PARC_(company)">Xerox Palo Alto Research Center</a>. This series of blog posts are my meandering exploration of Oberon-07 language based on <a href="http://www.projectoberon.com/">Project Oberon 2013</a>.</p> <p>NOTE: Oberon grew from Wirth’s Modula, which grew from Pascal, which grew from his experiences with Algol.</p> <h3 id="my-voyage">My Voyage</h3> <p>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 <a href="https://en.wikipedia.org/wiki/Turbo_Pascal">Turbo Pascal</a>. Oberon’s language shape is more Pascal than C. For that reason I think it has largely been overlooked.</p> <p>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 <a href="https://golang.org">Go</a>.</p> <p>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 <a href="https://en.wikipedia.org/wiki/POSIX">POSIX</a> 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.</p> <p>NOTE: Oberon was initially a project including the CERES Hardware, Oberon compiler and Oberon operating system for networked workstations.</p> <p>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 <a href="https://github.com/pdewacht/oberon-risc-emu">emulator</a>. 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.</p> <h2 id="a-starting-point">A starting point</h2> <p>I am starting my exploration with Karl Landström’s <a href="https://miasap.se/obnc/">OBNC</a> compiler. I am focusing on getting comfortable using and writing in the Oberon language.</p> <p>Here’s an example of a simple “Hello World” program in Oberon written for a POSIX system. I’ve named the <a href="HelloWorld.Mod">source code</a> <code>HelloWorld.Mod</code>.</p> <p>NOTE: In 2020 common POSIX systems include <a href="https://en.wikipedia.org/wiki/Linux">Linux</a>, <a href="https://en.wikipedia.org/wiki/Berkeley_Software_Distribution">BSD</a> and <a href="https://en.wikipedia.org/wiki/MacOS">macOS</a>.</p> <pre><code> MODULE HelloWorld; IMPORT Out; BEGIN Out.String("Hello World!"); Out.Ln; END HelloWorld. </code></pre> <p>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. <code>BEGIN</code> and <code>END</code> are similar to our opening and closing curly braces in C and the module is the basic unit of source code in Oberon. <code>IMPORT</code> includes the module <code>Out</code> (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.</p> <p>The <code>Out</code> module includes methods for displaying various data types native to Oberon. There is a corresponding <code>In</code> for receiving input as well as some additional modules provided with our chosen compiler implementation.</p> <p>Modules in Oberon can include a module wide initialization block. The <code>BEGIN</code> through <code>END HelloWorld.</code> are an initialization block. This is similar to C or Go’s “main” function for our POSIX environment.</p> <h3 id="obnc">OBNC</h3> <p>If you want to run my “Hello World” you need to compile it. I have found that <a href="https://miasap.se/obnc/">OBNC</a> compiler runs well on Linux, macOS and <a href="https://www.raspberrypi.org">Raspberry Pi</a>. 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.</p> <p>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 <a href="https://en.wikipedia.org/wiki/Cross_compiler">cross compiler</a>. This opens the door to <a href="https://en.wikipedia.org/wiki/Bare_machine">bare metal programming</a>.</p> <p>If you’re following along please install OBNC on your computer. Instructions are found at https://maisap.se/obnc. Karl also has excellent documentation and is responsive to questions about his implementation. His contact methods are included on his website.</p> <h3 id="running-obnc">Running OBNC</h3> <p>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.</p> <pre><code> obnc HelloWorld.Mod </code></pre> <p>If all goes well this should produce an executable file named <code>HelloWorld</code> (or <code>HelloWorld.exe</code> on Windows). You can now run this program with a command like <code>./HelloWorld</code> (or <code>HelloWorld</code> on Windows).</p> <h3 id="learning-more-about-oberon">Learning more about Oberon</h3> <p>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.</p> <p>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 <a href="http://www.projectoberon.com">www.projectoberon.com</a> 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 <a href="https://inf.ethz.ch/personal/wirth/">website</a> is still maintained and he features links to most of his major publications. His is the canonical source of information on Oberon.</p> <p>NOTE: Prof. Wirth’s personal website at ETH was available as of 2020-04-11.</p> <p>I have found the ACM <a href="https://dl.acm.org/">Digital Library</a> and the ETH <a href="https://www.research-collection.ethz.ch/?locale-attribute=en">Research Collection</a> 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.</p> <p>The online community for Oberon and Oberon System seems mostly centered around a <a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon">mail list</a> at ETH and net news group <a href="https://groups.google.com/forum/#!forum/comp.lang.oberon">comp.lang.oberon</a></p> <h3 id="next">Next</h3> <ul> <li>Next <a href="../12/Mostly-Oberon-Modules.html">Modules and Procedures</a></li> </ul> </article> </section> <footer> <p>copyright © 2016 - 2023 R. S. Doiel<br /> <a href="/rssfeed.html">RSS</a> feeds and website built with <a href="https://rsdoiel.github.io/pttk">pttk</a>, Bash, Make and <a href="https://pandoc.org">Pandoc</a>.</p> </footer> <!-- START: PrettyFi from https://github.com/google/code-prettify --> <script> /* We want to add the class "prettyprint" to all the pre elements */ var pre_list = document.querySelectorAll("pre"); pre_list.forEach(function(elem) { elem.classList.add("prettyprint"); elem.classList.add("linenums");/**/ elem.classList.add("json"); /**/ }); </script> <style> li.L0, li.L1, li.L2, li.L3, li.L4, li.L5, li.L6, li.L7, li.L8, li.L9 { color: #555; list-style-type: decimal; } </style> <link rel="stylesheet" type="text/css" href="/css/prettify.css"> <script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_ prettify.js"></script> <!-- END: PrettyFi from https://github.com/google/code-prettify --> </body> </html>