lboasso
lboasso on Hacker News
Author of oberonc here, thanks for trying it out :)
I think Fogus was able to summarize it quite well in his "Six works of Computer Science-Fiction" blog post [0]:
"Wirth’s magnum opus is the quintessential example of Computer Science alternative-history world-building."
Note that Oberon was not only the name of a programming language, it was also the name of an innovative (at that time) operating system.
It is possible to program real-world programs today in Oberon depending on the used implementation. For example oberonc [1] is a compiler targeting the JVM and allows you to leverage the JVM ecosystem by invoking Java code (or any other language that compiles to Java bytecode).
For more Oberon implementations see [2]
[0] http://blog.fogus.me/2015/04/27/six-works-of-computer-scienc...
[1] https://github.com/lboasso/oberonc
[2] http://oberon07.com/compilers.xhtml
It would be great to have a simple Virgil x86-64 backend based only on the destination-driven code generation technique, and compare the performance of the generated code (and compilation speed) with the official optimizing x86-64 backend.
Would the implementation effort be comparable to the JVM backend?
BTW I really like the design of Virgil described in "Harmonizing Classes, Functions, Tuples,and Type Parameters in Virgil III", bravo!
The Oberon programming language is 37 years old. Since it is a memory safe language a compiler for the JVM can be written (with some workarounds), for example see the self-hosting compiler oberonc [0].
[0] https://github.com/lboasso/oberonc
If you want to try out only the Oberon language, there are several Oberon implementations for different platforms, including embedded systems, native windows executables, and the Java virtual machine:
http://oberon07.com/compilers.xhtml
When I benchmarked oberonc [0], an oberon-07 self-hosting compiler for the JVM, it took about 100 ms with a hot VM on a old Intel i5 @ 2.80GHz. That compiler follows the same one-pass compilation approach.
[0] https://github.com/lboasso/oberonc
> And a lot of the compilers and tooling seems to be weirdly Windows-oriented
When I read this book I had an hard time running and compiling the source code included.
If you want to read the book and try out the example compiler (oberon0), you can follow the instructions here: https://github.com/lboasso/oberon0. You just need a JVM >= 8 and the oberonc compiler: https://github.com/lboasso/oberonc
If you want to try out the Oberon language, there are several Oberon implementations for different platforms, including embedded systems, native windows executables, and the Java virtual machine:
http://oberon07.com/compilers.xhtml
I wrote a self-hosted one pass compiler exactly to showcase Niklaus Wirth's approach to writing compilers:
https://github.com/lboasso/oberoncWe often forget this alternative way (with its pros and cons).
Here is the repo:
https://github.com/lboasso/oberon0Yes, you can write small Oberon-0 programs and compile them with an Oberon-07 compiler, but it is simpler to just use the Oberon-0 compiler from the repo above.
With
oberonc you can compile the source code at
http://www-oldurls.inf.ethz.ch/personal/wirth/CompilerConstr... with minor changes to the I/O library calls. I can push the changes in a repo if you are interested.
Oberon-0 is too limited to easily bootstrap itself. I wrote oberonc first in Java and then I rewrote it in Oberon-07 for the final bootstrap step.
Oberon-0 is a toy subset of the full Oberon-07 language.
For the excellent introductory book "Compiler Construction" by Niklaus Wirth, you could find compilers for the implementation language at
http://oberon07.com/compilers.xhtml.
If you have a JVM installed, you could use oberonc[0]. I have a local branch where I test that each release of the compiler can compile and run the examples in that book.
[0] https://github.com/lboasso/oberonc
Several other Oberon implementations exist for different platforms, including embedded systems, native windows executables, and the Java virtual machine:
http://oberon07.com/compilers.xhtml
I enjoyed most of it.
In particular:
* Ch. 4 "Modules Should Be Deep"
* Ch. 10 "Define Errors Out Of Existence"
* Ch. 20 "Designing for Performance"
Another excellent resource is "A Philosophy of Software Design" [0], from John Ousterhout (known for Tcl/Tk, Raft, RAMCloud, Log-Structured File System). Like Niklaus Wirth, he is striving for designs that fight complexities and yield simple and powerful abstractions. This book is so much better than overrated books like "Code Complete" and "Clean Code" for a fraction of the page count.
[0] https://www.amazon.com/Philosophy-Software-Design-John-Ouste...
Go was heavily influenced by Oberon, in fact Robert Griesemer is a former Wirth's PhD.
I have been following the development of Oberon-07 (and submitted minor fixes to Prof. Wirth) over the years. The compiler's source code is the fruit of refinements and simplifications accumulated over 30+ years (more if you include his compilers for previous languages). His approach for compiler writing, and system design in general, is outstanding. For more information about his compilers see "Compiler Construction - The Art of Niklaus Wirth" [0]
[0] http://oberon2005.oberoncore.ru/paper/art3.pdf
Bootstrapping a compiler is fun. I wrote a self-hosting compiler for the Oberon-07 language, targeting the JVM:
https://github.com/lboasso/oberoncInitially the project was written in Java, after enough features were working the bootstrap phase could start.
Wirth's compilers generated reasonably good code: 80% of the performance of optimizing compilers with 20% of the effort.
The first Java client jit compiler, was developed by Robert Griesemer (former PhD student of Wirth). The design of the compiler is described in the paper "A compiler for the java hotspot virtual machine", published in the same book: "The School of Niklaus Wirth: The Art of Simplicity".