Oxford Oberon-2 compiler

From Spivey's Corner
Jump to: navigation, search

At Oxford, we have sometimes used Oberon as the second language we teach to our undergraduate students (the first one is Haskell). We chose it because of its cleanliness and simplicity, and because of the availability of books that emphasize clear reasoning about programs. Yes, it seems old-fashioned in some ways, but partly that's because it is closer to the hardware than is now the fashion. And it's hard to find another language with a defining document that comes in under 20 pages.

To support this teaching within our Unix-based software laboratory, I have developed from scratch a portable compiler that translates Oberon-2 into bytecode, which can be either interpreted or dynamically translated into machine code. Dynamic translation uses a portable interface modelled on the one in GNU Lightning, but is so far implemented only on x86 machines. The implementation includes a full garbage collector, and comes with profiling tools and a simple GUI debugger.

This implementation of the Oberon-2 language does not include a version of the Oberon-2 operating system and programming environment; instead, programs are edited with the tools of the host operating system and compiled into executables that run like other programs on the host system.

The compiler is written in Objective Caml, and the runtime system is written in C. It is not necessary to have Objective Caml installed in order to use the binary distributions listed below, but it is needed in order to build the system from the source distribution. The build process also uses some scripts written in Tcl.

Watch this space for further technical information!


The binary distributions include the Objective Caml run-time system. which is covered by the GNU Library Public Licence. Objective Caml may be obtained from http://caml.inria.fr.

Software Licence

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.

This software is provided by the author "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the author be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.