Oberon (programming language)
|Paradigms||Imperative, structured, modular, object-oriented|
|Designed by||Niklaus Wirth|
Oberon-07 / 6 March 2020
|Typing discipline||Strong, hybrid (static and dynamic)|
|Platform||ARM, StrongARM; IA-32, x86-64; SPARC, Ceres (NS32032)|
|OS||Windows, Linux, Solaris, classic Mac OS, Atari TOS, AmigaOS|
|Oberon-2, Oberon-07, Zonnon, Go, Nim, Active Oberon, Component Pascal|
Oberon is a general-purpose programming language first published in 1987 by Niklaus Wirth and the latest member of the Wirthian family of ALGOL-like languages (Euler, ALGOL W, Pascal, Modula, and Modula-2). Oberon was the result of a concentrated effort to increase the power of Modula-2, the direct successor of Pascal, and simultaneously to reduce its complexity. Its principal new feature is the concept of type extension of record types. It permits constructing new data types on the basis of existing ones and to relate them, deviating from the dogma of strictly static typing of data. Type extension is Wirth's way of inheritance reflecting the viewpoint of the parent site. Oberon was developed as part of the implementation of an operating system, also named Oberon at ETH Zurich in Switzerland. The name is from the moon of the planet Uranus, named Oberon.
Oberon is still maintained by Wirth and the latest Project Oberon compiler update is dated 6 March 2020.
Oberon is designed with a motto attributed to Albert Einstein in mind: “Make things as simple as possible, but not simpler.” The principal guideline was to concentrate on features that are basic and essential and to omit ephemeral issues. Another factor was recognition of the growth of complexity in languages such as C++ and Ada. In contrast to these, Oberon emphasizes the use of the library concept to extend the language. Enumeration and subrange types, which were present in Modula-2, were omitted; similarly, set types have been limited to small sets of integers, and the number of low-level facilities has been sharply reduced (especially, type transfer functions were omitted). Omitting the remaining potentially unsafe facilities concludes the most essential step toward obtaining a truly high-level programming language. Very close type checking even across modules, strict index checking at runtime, null pointer checking, and the safe type extension concept largely allow programming to rely on the language rules alone.
The intent of this strategy was to produce a language that is easier to learn, simpler to implement, and very efficient. Oberon compilers have been viewed as compact and fast, while providing adequate code quality compared to commercial compilers.
Features characterizing the Oberon language include:
- Case sensitive syntax with uppercase keywords
- Type-extension with type test
- Modules and separate compiling
- String operations
- Isolating unsafe code
- Support for system programming
Oberon supports extension of record types for the construction of abstractions and heterogeneous structures. In contrast to the later dialects, Oberon-2 and Active Oberon, the original Oberon lacks a dispatch mechanism as a language feature but has it as a programming technique or design pattern. This gives great flexibility in OOP. In the Oberon operating system, two programming techniques are used together for the dispatch call: Method suite and Message handler.
MODULE Figures; (* Abstract module *) TYPE Figure* = POINTER TO FigureDesc; Interface* = POINTER TO InterfaceDesc; InterfaceDesc* = RECORD draw* : PROCEDURE (f : Figure); clear* : PROCEDURE (f : Figure); mark* : PROCEDURE (f : Figure); move* : PROCEDURE (f : Figure; dx, dy : INTEGER); END; FigureDesc* = RECORD if : Interface; END; PROCEDURE Init* (f : Figure; if : Interface); BEGIN f.if := if; END Init; PROCEDURE Draw* (f : Figure); BEGIN f.if.draw(f); END Draw; (* Other procedures here *) END Figures.
We extend the generic type Figure to a specific shape:
MODULE Rectangles; IMPORT Figures; TYPE Rectangle* = POINTER TO RectangleDesc; RectangleDesc* = RECORD (Figures.FigureDesc) x, y, w, h : INTEGER; END; VAR if : Figures.Interface; PROCEDURE New* (VAR r : Rectangle); BEGIN NEW(r); Figures.Init(r, if); END New; PROCEDURE Draw* (f : Figure); VAR r : Rectangle; BEGIN r := f(Rectangle); (* f AS Rectangle *) (* ... *) END Draw; (* Other procedures here *) BEGIN (* Module initialisation *) NEW(if); if.draw := Draw; if.clear := Clear; if.mark := Mark; if.move := Move; END Rectangles.
Dynamic dispatch is only done via procedures in Figures module that is the generic module.
This technique consists of replacing the set of methods with a single procedure, which discriminates among the various methods:
MODULE Figures; (* Abstract module *) TYPE Figure* = POINTER TO FigureDesc; Message* = RECORD END; DrawMsg* = RECORD (Message) END; ClearMsg* = RECORD (Message) END; MarkMsg* = RECORD (Message) END; MoveMsg* = RECORD (Message) dx*, dy* : INTEGER END; Handler* = PROCEDURE (f : Figure; VAR msg : Message); FigureDesc* = RECORD (* Abstract *) handle : Handler; END; PROCEDURE Handle* (f : Figure; VAR msg : Message); BEGIN f.handle(f, msg); END Handle; PROCEDURE Init* (f : Figure; handle : Handler); BEGIN f.handle := handle; END Init; END Figures.
We extend the generic type Figure to a specific shape:
MODULE Rectangles; IMPORT Figures; TYPE Rectangle* = POINTER TO RectangleDesc; RectangleDesc* = RECORD (Figures.FigureDesc) x, y, w, h : INTEGER; END; PROCEDURE Draw* (r : Rectangle); BEGIN (* ... *) END Draw; (* Other procedures here *) PROCEDURE Handle* (f: Figure; VAR msg: Figures.Message); VAR r : Rectangle; BEGIN r := f(Rectangle); IF msg IS Figures.DrawMsg THEN Draw(r) ELSIF msg IS Figures.MarkMsg THEN Mark(r) ELSIF msg IS Figures.MoveMsg THEN Move(r, msg(Figures.MoveMsg).dx, msg(Figures.MoveMsg).dy) ELSE (* ignore *) END END Handle; PROCEDURE New* (VAR r : Rectangle); BEGIN NEW(r); Figures.Init(r, Handle); END New; END Rectangles.
In the Oberon operating system both of these techniques are used for dynamic dispatch. The first one is used for a known set of methods; the second is used for any new methods declared in the extension module. For example, if the extension module Rectangles were to implement a new Rotate() procedure, within the Figures module it could only be called via a message handler.
Implementations and variants
No-cost implementations of Oberon (the language) and Oberon (the operating system) can be found on the Internet (several are from ETHZ itself).
A few changes were made to the first released specification. For example, object-oriented programming (OOP) features were added, the
FOR loop was reinstated. The result was Oberon-2. One release, named Native Oberon which includes an operating system, and can directly boot on IBM PC compatible class hardware. A .NET implementation of Oberon with the addition of some minor .NET-related extensions was also developed at ETHZ. In 1993, an ETHZ spin off company brought a dialect of Oberon-2 to the market named Oberon-L. In 1997, it was renamed Component Pascal.
Oberon-2 compilers developed by ETH include versions for Microsoft Windows, Linux, Solaris, and classic Mac OS. Implementations from other sources exist for some other operating systems, including Atari TOS and AmigaOS.
Other compilers include Oxford Oberon-2, which also understands Oberon-07, and Vishap Oberon. The latter is based on Josef Templ's Oberon to C language source-to-source compiler (transpiler) named Ofront, which in turn is based on the OP2 Compiler developed by Regis Crelier at ETHZ.
Oberon-07, defined by Niklaus Wirth in 2007 and revised in 2008, 2011, 2013, 2014, 2015, and 2016 is based on the original version of Oberon rather than Oberon-2. The main changes are: explicit numeric conversion functions (e.g.,
FLT) must be used, the
EXIT statements were omitted,
WHILE statements were extended,
CASE statements can be used for type extension tests,
RETURN statements can only be connected to the end of a function, imported variables and structured value parameters are read-only and arrays can be assigned without using
Active Oberon is yet another variant of Oberon, which adds objects (with object-centered access protection and local activity control), system-guarded assertions, preemptive priority scheduling and a changed syntax for methods (named type-bound procedures in Oberon vocabulary). Objects may be active, which means that they may be threads or processes. Further, Active Oberon has a way to implement operators (including overloading), an advanced syntax for using arrays (see OberonX language extensions and Proceedings of the 7th Joint Modular Languages Conference 2006 Oxford, UK), and knows about namespaces. The operating system A2 (formerly Active Object System (AOS), then Bluebottle), especially the kernel, synchronizes and coordinates different active objects.
ETHZ has released Active Oberon which supports active objects, and the operating systems based thereon (Active Object System (AOS), Bluebottle, A2), and environment (JDK, HTTP, FTP, etc.) for the language. As with many prior designs from ETHZ, versions of both are available for download on the Internet. As of 2003, supported central processing units (CPUs) include single and dual core x86, and StrongARM.
Development has continued on languages in this family. A further extension of Oberon-2, originally named Oberon/L but later renamed to Component Pascal, was developed for Windows and classic Mac OS by Oberon microsystems, a commercial company spin-off from ETHZ, and for .NET by Queensland University of Technology. Further, the languages Lagoona and Obliq carry Oberon methods into specialized areas.
Recent .NET development efforts at ETHZ have been focused on a new language named Zonnon. This includes the features of Oberon and restores some from Pascal (enumerated types, built-in IO) but has some syntactic differences. Other features include support for active objects, operator overloading, and exception handling. Zonnon is available as a plug-in language for the Microsoft Visual Studio for .NET development environment.
Oberon-V (originally named Seneca, after Seneca the Younger) is a descendant of Oberon designed for numerical applications on supercomputers, especially vector or pipelined architectures. It includes array constructors and an
- Official website (latest available copy at archive org) at ETH-Zürich
- Niklaus Wirth's Oberon Page at ETH-Zürich
- Oberon Page at SSW, Linz
- Oberon: The Programming Language at Ulm
- Project Oberon, The Design of an Operating System and a Compiler, book in PDF by Niklaus Wirth and Jürg Gutknecht, 2005 Edition
- Oberon Language Genealogy
- Astrobe ARM Oberon-07 Development System
- Oberon System V4 for HP OpenVMS Alpha with source code upward-compatible 64 bit addressing
- 64 bit Oberon-2 compiler for HP OpenVMS Alpha
- Oxford Oberon-2 Compiler and its User Manual
- Free Oberon-07 IDE Free Oberon-07 IDE for Windows, Macintosh, and Linux with syntax colouring, semantic navigation and source code debugger
- Oberon article by Joseph Templ in the January 1994 issue of Dr.Dobbs
Evolution of Oberon
- Modula-2 and Oberon Wirth (2005)
- The Programming Language Oberon Wirth, (1988/90)
- The Programming Language Oberon (Oberon-7, Revised Oberon) Wirth, (2016, most current language report)
- Differences between Oberon-07 and Oberon Wirth (2011)
- The Programming Language Oberon-2 H. Mössenböck, N. Wirth, Institut für Computersysteme, ETH Zürich, January 1992
- Differences between Oberon and Oberon-2 Mössenböck and Wirth (1991)
- What's New in Component Pascal (Changes from Oberon-2 to CP), Pfister (2001)
- Wirth, Niklaus. From Modula to Oberon and the programming language Oberon (Report). ETH Technical Reports D-INFK. Band 82. Wiley.
- Wirth, Niklaus (July 1988). "The Programming Language Oberon". Software: Practice and Experience. 18 (7): 661–670.
- Wirth, Niklaus (July 1988). From Modula to Oberon. Software: Practice and Experience (Report). 18. pp. 671–690.
- Wirth, Niklaus (April 1988). "Type Extensions". ACM Transactions on Programming Languages. 10 (2): 204–214.
- Pountain, D. March 1991. "Modula's Children, Part II: Oberon". Byte. Vol. 16 no. 3. pp. 135–142.
- Wirth, Niklaus. "Oberon Change Log". ETH Zurich. Retrieved 16 January 2021.
- Mössenböck, Hanspeter. "Compiler Construction: The Art of Niklaus Wirth" (PDF). Johannes Kepler University.
- Wirth, Niklaus; Gutknecht, Jürg (1987–2021). "Project Oberon".
- Spivey (8 April 2019). "Oxford Oberon-2 compiler". Retrieved 17 January 2021.
- dcwbrown (16 June 2020). "Vishap Oberon Compiler". GitHub. Retrieved 17 January 2021.
- jtempl (2 January 2020). "Ofront". GitHub. Retrieved 17 January 2021.
- Wirth, Niklaus (3 May 2016). The Programming Language Oberon-07 (PDF). ETH Zurich, Department of Computer Science (Report). Retrieved 17 January 2021.
- Friedrich, Felix; Gutknecht, Jürg (2006). "Array-Structured Object Types for Mathematical Programming". In Lightfoot, David E.; Szyperski, Clemens (eds.). Modular Programming Languages. Modular Programming Languages. Lecture Notes in Computer Science. 4228. Springer, Berlin Heidelberg. pp. 195–210. doi:10.1007/11860990_13. ISBN 978-3-540-40927-4.
- "Proposal for Module Contexts" (PDF).
- Muller, Pieter Johannes (2002). The active object system design and multiprocessor implementation (PDF) (PhD). Swiss Federal Institute of Technology, Zürich (ETH Zurich).
- Fröhlich, Peter H.; Franz, Michael. On Certain Basic Properties of Component-Oriented Programming Languages (PDF) (Report). University of California, Irvine. Retrieved 18 January 2021.
- Fröhlich, Peter H.; Gal, Andreas; Franz, Michael (April 2005). "Supporting software composition at the programming language level". Science of Computer Programming. Elsevier B.V. 56 (1–2): 41–57. doi:10.1016/j.scico.2004.11.004. Retrieved 18 January 2021.
- Franz, Michael; Fröhlich, Peter H.; Kistler, Thomas (20 November 1999). "Towards language support for component-oriented real-time programming". Proceedings: Fifth International Workshop on Object-Oriented Real-Time Dependable Systems. Institute of Electrical and Electronics Engineers (IEEE). pp. 125–129. doi:10.1109/WORDSF.1999.842343. ISBN 0-7695-0616-X. Retrieved 21 January 2021.
- Griesemer, Robert (1993). "A Language for Numerical Applications on Vector Computers". Proceedings CONPAR 90: VAPP IV Conference, Diss Nr. 10277. ETH Zurich.