[Oberon] OP2 vs. Single-Pass

Michael McGaw mcgawma at yahoo.com
Wed Aug 2 15:43:17 CEST 2017

  On the matter of OP2 vs. single-pass Wirth compiler:
1. There are far more CPUs supported by OP2 than this single pass.2. The code generation can be cleanly separated in OP2, and not as easily in the single pass3. *** OP2 supports the Oberon and Oberon-2 syntax ***  No source changes to S3 or V4 code must be made to use it.  Single Pass (RISC5) demands many changes, potentially.4. OP2 is well sorted, and stable.  Predictable in its behavior.5. OP2, because it uses an AST, enables many interesting things to be done: a) an AST-traversing interpreter; b) debugger support; c) code slicing support.  Many theses and dissertations from Linz shows this.6. It is not very difficult to make a version of OP2 that supports multiple CPU targets via switches.7. One of the targets could be the C source output backend for Ofront.

What is needed, with regard to OP2, IMHO:
1. It would be VERY useful to have a back end for OP2 that targeted a purpose-built interpreter (processing something like byte code from a linear file, not a tree-traversing interpreter).  Here, it would be very helpful to have it support an instruction set for which a clean and simple interpreter exists or can be built.  I am thinking specifically of an instruction set not far from the Lilith-inspired KRONOS 32-bit CPU.  This would permit a very portable interpreter that could be retargeted with ease (use Ofront, for example, to machine generate a C version).  Once this is accomplished, the systems, their compiler (and target generators) and nearly all of the code base would live on indefinitely.
2. It would be nice to support RISC5's CPU and system architecture
Both compilers have their purpose: OP2 is regarded by some as being somewhat 'inscrutable', and most of the published (e.g., available source implementations) progress with OP2 has been accomplished by those who were trained at ETH, and have had direct experience with it.  But it remains a bit of a climb for the uninitiated.  The single pass design is lauded by others for its simplicity.  Both compilers show how it is possible to radically reduce the source expression of a real and useful language design, provided that this language design is done intelligently, achieving a source expression that is 10x or more reduced in size over something like C.  The single pass version lends itself to the task of teaching compiler design, and is without peer in this regard.  OP2 supports a much larger code base that many users find helpful.
One person's opinion.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20170802/055743e4/attachment.html>

More information about the Oberon mailing list