Implementation Strategy
Existing Compilers
Many Oberon compilers have been derived from the compiler created by Niklaus
Wirth and Jürg Gutknecht as part of Project Oberon (the PO compiler) [WiGut]. It is written in Oberon, generates code
for the NS 32000 processor, and runs as a tool in the Oberon system. This syntax
driven compiler uses recursive decent and generates code immediately without any
intermediate representation. Code optimization is therefore not a simple task.
The compiler is very concise, small, and easy to understand.
Andreas Borchert has written a compiler for the SUN-3 computers, which is not
based on the Project Oberon implementation [Borchert]. This one is written in Modula-2
and generates assembly source code in a text file, which has to be processed by a
linker in order to produce a program. Although this peculiarity seems to be a
deficiency, it makes the step to another operating system with the same processor
very small. Lack of speed together with the two-step process make Borchert-Oberon
however unsuitable for larger projects.
The Macintosh is based on a Motorola 680x0 processor. The new PowerPC-based
Macintosh models emulate this processor perfectly and provide a path to RISC
performance for new applications. Three Oberon compilers generating code for the
680x0 are available readily: MacOberon, MacOberon Lite, and Borchert-Oberon.
MacOberon and MacOberon Lite, developed at the ETH Zürich, are furthermore
capable of running on the Macintosh operating system. In the case of MacOberon,
the compiler is only available within the Oberon System [Franz]. In both systems a special linker is used
to generate Macintosh applications. It puts the actual program code in the data
area (data fork) of the special Oberon loader application. This custom loader
replaces the generic Macintosh program loader and manages the Oberon code
modules.
Migration
Because it is readily available and well structured, we decided to port the
Project Oberon (PO) compiler for the 32000 architecture to the 68000 and the
Macintosh. As stated above, this compiler is written in Oberon, so we needed a
compiler on the Macintosh for the bootstrap process. This is where Borchert's
compiler came into the process (see figure 1): We
- moved the Borchert compiler to the Macintosh and compiled it with the p1
Modula-2 compiler for MPW,
- modified the Borchert compiler so that it generates MPW instead of SUN
assembly source code,
- developed a 68000 code generator for the PO compiler,
- implemented the MPW object file format in the PO compiler, and
- compiled the PO compiler with itself.

Figure 1: From the Project Oberon Compiler to MPW Oberon (a)
with existing tools (b) The T-Diagram symbolism is explained in [Wirth1]
Previous Section, Next Section, Contents