Oxford Oberon-2 compiler
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, and is so far implemented on x86 and ARM machines, including the Raspberry Pi. 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 the Objective Caml compiler 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.
- Installing OBC release 3.3.
- If you have a Windows or Mac system, then binaries exist for installing OBC release 3.1.
- How to add primitives to OBC.
- Notes on changes in Oberon07.
- Another page has links to some (slightly outdated) design documents for the compiler.
Acknowledgements
The binary distributions include the Objective Caml run-time system.
which is covered by the GNU Library Public Licence.
The GUI for the debugger is implemented using the lablgtk
bindings from OCaml to GTK;
an adapted version of the lablgtk
source is included in the sources for OBC.
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:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- 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.
- 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.