The Oxford Oberon-2 Compiler

At Oxford, we use 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.

To support this teaching within our Unix-based software laboratory, I have developed from scratch a portable compiler that translates Oberon-2 into bytecode. This implementation is in use at Oxford on SparcStations and 386 PC's under Solaris, on 386 PC's under Linux, and on 386 PC's under Windows. There should be little difficulty in porting the system to other 32-bit Unix systems.

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 lab manual offered below contains exercises that rely on Oberon programs that work together with other Unix tools and utilities.

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. The binary distribution for DOS and Windows was built using MSYS/MinGW. It is not necessary to install either of these in order to use the Oberon compiler or run Oberon programs.

Why the downgrade?

Previously, I released a version of OBC numbered 2.5; the chief difference between this and the present version 2.4 is that it contained an Oberon-specific garbage collector, and version 2.4 continues to rely on the conservative garbage collector of Hans-J. Boehm. It's not so much that there are known problems with the Oberon-specific collector, but that it hasn't been tested extensively enough to be confident in it. Until I've had time to conduct more extensive testing, and a little performance analysis, I suggest that version 2.4 is a better choice for general use.

Version 2.4 (released December, 2006)

Click here to download:

Instructors who wish to use the practical exercises for teaching are welcome to enquire about obtaining the source materials of the exercises. I'd love to hear from you (E-mail: mike@comlab.ox.ac.uk); perhaps we can collaborate on extending the material.

Revision history

Version 2.4.2
Fixes a problem on the Mac. Calls GC_INIT to initialise the Boehm garbage collector from the runtime system. This is a no-op on many platforms, but is needed for the GC to work properly on Macs.
Version 2.4.1
Fixes a problem that cropped up on Windows Vista. The function tmpnam in MinGW creates a file in the root directory of the current drive, and Vista sensibly doesn't allow that.
Version 2.4.0
Initial release

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.

Acknowledgements

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

The binary distributions also include the conservative garbage collector of Hans-J. Boehm and others. The source code may be obtained from http://www.hpl.hp.com/personal/Hans_Boehm/gc.


Mike Spivey
mike@comlab.ox.ac.uk