Oberon (programming language)

Last updated

Oberon
Oberon programming language logo.svg
Paradigms Imperative, structured, modular, object-oriented
Family Wirth Oberon
Designed by Niklaus Wirth  OOjs UI icon edit-ltr-progressive.svg
Developer Niklaus Wirth  OOjs UI icon edit-ltr-progressive.svg
First appeared1987;37 years ago (1987)
Stable release
Oberon-07 / 6 March 2020;3 years ago (2020-03-06)
Typing discipline Strong, hybrid (static and dynamic)
Scope Lexical
Platform ARM, StrongARM; IA-32, x86-64; SPARC, Ceres (NS32032)
OS Windows, Linux, Solaris, classic Mac OS, Atari TOS, AmigaOS
Website projectoberon.net
Influenced by
Modula-2
Influenced
Oberon-2, Oberon-07, Active Oberon, Component Pascal, Zonnon, Go, V (Vlang), Nim

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). [1] [2] [3] [4] 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. [5] 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 was inspired both by the Voyager space probe's pictures of the moon of the planet Uranus, named Oberon, and because Oberon is famous as the king of the elfs. [6]

Contents

Oberon was maintained by Wirth and the latest Project Oberon compiler update is dated 6 March 2020. [7]

Design

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, and set types are limited to sets of integers. All imported items must be qualified by the name of the module where they are declared. Low-level facilities are highlighted by only allowing them to be used in a module which includes the identifier SYSTEM in its import list. Strict type checking, even across modules, and 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 code quality comparable to commercial compilers. [8]

Characteristics

Features characterizing the Oberon language include: [9]

Object orientation

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.

Method suite

In this technique, a table of procedure variables is defined and a global variable of this type is declared in the extended module and assigned back in the generic module:

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); BEGINNEW(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.

Message handler

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* : INTEGEREND;     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 *)ENDEND Handle;  PROCEDURE New* (VAR r : Rectangle); BEGINNEW(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

Oberon

No-cost implementations of Oberon (the language) and Oberon (the operating system) can be found on the Internet (several are from ETHZ itself).

Oberon-2

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.

There is an Oberon-2 Lex scanner and Yacc parser by Stephen J Bevan of Manchester University, UK, based on the one in the Mössenböck and Wirth reference. It is at version 1.4.

Other compilers include Oxford Oberon-2, [10] which also understands Oberon-07, and Vishap Oberon. [11] The latter is based on Josef Templ's Oberon to C language source-to-source compiler (transpiler) named Ofront, [12] which in turn is based on the OP2 Compiler developed by Regis Crelier at ETHZ.

Oberon-07

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., FLOOR and FLT) must be used; the WITH, LOOP and 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 COPY. [13]

Oberon-07 compilers have been developed for use with many different computer systems. Wirth's compiler targets a reduced instruction set computer (RISC) processor of his own design that was used to implement the 2013 version of the Project Oberon operating system on a Xilinx field-programmable gate array (FPGA) Spartan-3 board. Ports of the RISC processor to FPGA Spartan-6, Spartan-7, Artix-7 and a RISC emulator for Windows (compilable on Linux and macOS, and binaries available for Windows) also exist. OBNC compiles via C and can be used on any Portable Operating System Interface (POSIX) compatible operating system. The commercial Astrobe implementation targets 32-bit ARM Cortex-M3, M4 and M7 microcontrollers. The Patchouli compiler produces 64-bit Windows binaries. Oberon-07M produces 32-bit Windows binaries and implements revision 2008 of the language. Akron's produces binaries for both Windows and Linux. OberonJS translates Oberon to JavaScript. There is online IDE for Oberon. oberonc is an implementation for the Java virtual machine.

Active Oberon

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 [14] of the 7th Joint Modular Languages Conference 2006 Oxford, UK), and knows about namespaces. [15] The operating system A2 (formerly Active Object System (AOS), [16] 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 continued on languages in this family. A further extension of Oberon-2 was originally named Oberon/L but later renamed to Component Pascal (CP). CP was developed for Windows and classic Mac OS by Oberon microsystems, a commercial spin-off company from ETHZ, and for .NET by Queensland University of Technology. Further, the languages Lagoona [17] [18] [19] and Obliq carry Oberon methods into specialized areas.

Later .NET development efforts at ETHZ 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.

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 ALL statement. [20]

See also

Resources

General

Evolution of Oberon

Related Research Articles

The Modula programming language is a descendant of the Pascal language. It was developed in Switzerland, at ETH Zurich, in the mid-1970s by Niklaus Wirth, the same person who designed Pascal. The main innovation of Modula over Pascal is a module system, used for grouping sets of related declarations into program units; hence the name Modula. The language is defined in a report by Wirth called Modula. A language for modular multiprogramming published 1976.

<span class="mw-page-title-main">Niklaus Wirth</span> Swiss computer scientist (1934–2024)

Niklaus Emil Wirth was a Swiss computer scientist. He designed several programming languages, including Pascal, and pioneered several classic topics in software engineering. In 1984, he won the Turing Award, generally recognized as the highest distinction in computer science, "for developing a sequence of innovative computer languages".

Pascal is an imperative and procedural programming language, designed by Niklaus Wirth as a small, efficient language intended to encourage good programming practices using structured programming and data structuring. It is named after French mathematician, philosopher and physicist Blaise Pascal.

An object-oriented operating system is an operating system that is designed, structured, and operated using object-oriented programming principles.

<span class="mw-page-title-main">Modula-3</span>

Modula-3 is a programming language conceived as a successor to an upgraded version of Modula-2 known as Modula-2+. While it has been influential in research circles it has not been adopted widely in industry. It was designed by Luca Cardelli, James Donahue, Lucille Glassman, Mick Jordan, Bill Kalsow and Greg Nelson at the Digital Equipment Corporation (DEC) Systems Research Center (SRC) and the Olivetti Research Center (ORC) in the late 1980s.

<span class="mw-page-title-main">Oberon (operating system)</span> Operating system

The Oberon System is a modular, single-user, single-process, multitasking operating system written in the programming language Oberon. It was originally developed in the late 1980s at ETH Zurich. The Oberon System has an unconventional visual text user interface (TUI) instead of a conventional command-line interface (CLI) or graphical user interface (GUI). This TUI was very innovative in its time and influenced the design of the Acme text editor for the Plan 9 from Bell Labs operating system.

Component Pascal is a programming language in the tradition of Niklaus Wirth's Pascal, Modula-2, Oberon and Oberon-2. It bears the name of the language Pascal and preserves its heritage, but is incompatible with Pascal. Instead, it is a minor variant and refinement of Oberon-2 with a more expressive type system and built-in string support. Component Pascal was originally named Oberon/L, and was designed and supported by a small ETH Zürich spin-off company named Oberon microsystems. They developed an integrated development environment (IDE) named BlackBox Component Builder. Since 2014, development and support has been taken over by a small group of volunteers. The first version of the IDE was released in 1994, as Oberon/F. At the time, it presented a novel approach to graphical user interface (GUI) construction based on editable forms, where fields and command buttons are linked to exported variables and executable procedures. This approach bears some similarity to the code-behind way used in Microsoft's .NET 3.0 to access code in Extensible Application Markup Language (XAML), which was released in 2008.

<span class="mw-page-title-main">Lilith (computer)</span> 1980 custom-built workstation computer

The DISER Lilith is a custom built workstation computer based on the Advanced Micro Devices (AMD) 2901 bit slicing processor, created by a group led by Niklaus Wirth at ETH Zurich. The project began in 1977, and by 1984 several hundred workstations were in use. It has a high resolution full page portrait oriented cathode ray tube display, a mouse, a laser printer interface, and a computer networking interface. Its software is written fully in Modula-2 and includes a relational database program named Lidas.

<span class="mw-page-title-main">Oberon-2</span>

Oberon-2 is an extension of the original Oberon programming language that adds limited reflection and object-oriented programming facilities, open arrays as pointer base types, read-only field export, and reintroduces the FOR loop from Modula-2.

PL/0 is a programming language, intended as an educational programming language, that is similar to but much simpler than Pascal, a general-purpose programming language. It serves as an example of how to construct a compiler. It was originally introduced in the book, Algorithms + Data Structures = Programs, by Niklaus Wirth in 1976. It features quite limited language constructs: there are no real numbers, very few basic arithmetic operations and no control-flow constructs other than "if" and "while" blocks. While these limitations make writing real applications in this language impractical, it helps the compiler remain compact and simple.

Modular programming is a software design technique that emphasizes separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired functionality.

Kronos is a series of 32-bit processor equipped printed circuit board systems, and the workstations based thereon, of a proprietary hardware architecture developed in the mid-1980s in Akademgorodok, a research city in Siberia, by the Academy of Sciences of the Soviet Union, Siberian branch, Novosibirsk Computing Center, Modular Asynchronous Developable Systems (MARS) project, Kronos Research Group (KRG).

A2 is a modular, object-oriented operating system with unconventional features including automatic garbage-collected memory management, and a zooming user interface. It was developed originally at ETH Zurich in 2002. It is free and open-source software under a BSD-like license.

IP Pascal is an implementation of the Pascal programming language using the IP portability platform, a multiple machine, operating system and language implementation system. It implements the language "Pascaline", and has passed the Pascal Validation Suite.

<span class="mw-page-title-main">BlackBox Component Builder</span> Software development tool

BlackBox Component Builder is an integrated development environment (IDE) optimized for component-based software development developed by a small spin-off company, Oberon microsystems AG, of ETH Zurich in Switzerland. The IDE consists of development tools, a library of reusable components, a framework that simplifies developing robust custom components and applications, and a run-time environment for components.

<span class="mw-page-title-main">Active Oberon</span>

Active Oberon is a general purpose programming language developed during 1996-1998 by the group around Niklaus Wirth and Jürg Gutknecht at the Swiss Federal Institute of Technology in Zürich. It is an extension of the programming language Oberon. The extensions aim at implementing active objects as expressions for parallelism. Compared to its predecessors, Oberon and Oberon-2, Active Oberon adds objects, system-guarded assertions, preemptive priority scheduling and a changed syntax for methods. Objects may be active, which means that they may be threads or processes. As it is tradition in the Oberon world, the Active Oberon language compiler is implemented in Active Oberon. The operating system named Active Object System (AOS) in 2002, then due to trademark issues, renamed Bluebottle in 2005, and then renamed A2 in 2008, especially the kernel, synchronizes and coordinates different active objects.

The Ceres Workstation was a workstation computer built by Niklaus Wirth's group at ETH Zurich in 1987. The central processing unit (CPU) is a National Semiconductor NS32000, and the operating system, named Oberon System is written fully in the object-oriented programming language Oberon. It is an early example of an operating system using basic object-oriented principles and garbage collection on the system level and a document centered approach for the user interface (UI), as envisaged later with OpenDoc. Ceres was a follow-up project to the Lilith workstation, based on AMD bit slicing technology and the programming language Modula-2.

Modula-2 is a structured, procedural programming language developed between 1977 and 1985/8 by Niklaus Wirth at ETH Zurich. It was created as the language for the operating system and application software of the Lilith personal workstation. It was later used for programming outside the context of the Lilith.

Jürg Gutknecht is a Swiss computer scientist. He developed, with Niklaus Wirth, the programming language Oberon and the corresponding operating system Oberon.

Zonnon is a general purpose programming language in the line or family of the preceding languages Pascal, Modula, and Oberon. Jürg Gutknecht is the author.

References

  1. Wirth, Niklaus (1987). From Modula to Oberon and the programming language Oberon (Report). ETH Technical Reports D-INFK. Vol. Band 82. Wiley. doi:10.3929/ethz-a-005363226.
  2. Wirth, Niklaus (July 1988). "The Programming Language Oberon". Software: Practice and Experience. 18 (7): 661–670. doi:10.1002/spe.4380180707.
  3. Wirth, Niklaus (July 1988). "From Modula to Oberon". Software: Practice and Experience. 18 (7): 671–690. doi:10.1002/spe.4380180706. S2CID   13092279.
  4. Wirth, Niklaus (April 1988). "Type Extensions". ACM Transactions on Programming Languages. 10 (2): 204–214. doi: 10.1145/42190.46167 . S2CID   15829497.
  5. Pountain, D. March 1991. "Modula's Children, Part II: Oberon". Byte . Vol. 16, no. 3. pp. 135–142.{{cite magazine}}: CS1 maint: numeric names: authors list (link)
  6. Wirth, Niklaus; Gutknecht, Jürg (1987–2021). "Project Oberon" (PDF).
  7. Wirth, Niklaus. "Oberon Change Log". ETH Zurich. Retrieved 16 January 2021.
  8. Mössenböck, Hanspeter. "Compiler Construction: The Art of Niklaus Wirth" (PDF). Johannes Kepler University.
  9. Wirth, Niklaus; Gutknecht, Jürg (1987–2021). "Project Oberon".
  10. Spivey (8 April 2019). "Oxford Oberon-2 compiler" . Retrieved 17 January 2021.
  11. dcwbrown (16 June 2020). "Vishap Oberon Compiler". GitHub. Retrieved 17 January 2021.
  12. jtempl (2 January 2020). "Ofront". GitHub. Retrieved 17 January 2021.
  13. Wirth, Niklaus (3 May 2016). The Programming Language Oberon-07 (PDF). ETH Zurich, Department of Computer Science (Report). Retrieved 17 January 2021.
  14. Friedrich, Felix; Gutknecht, Jürg (2006). "Array-Structured Object Types for Mathematical Programming". In Lightfoot, David E.; Szyperski, Clemens (eds.). Modular Programming Languages. Lecture Notes in Computer Science. Vol. 4228. Springer, Berlin Heidelberg. pp. 195–210. doi:10.1007/11860990_13. ISBN   978-3-540-40927-4. S2CID   34210781.
  15. "Proposal for Module Contexts" (PDF).
  16. Muller, Pieter Johannes (2002). The active object system design and multiprocessor implementation (PDF) (PhD). Swiss Federal Institute of Technology, Zürich (ETH Zurich).
  17. 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.
  18. 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.
  19. 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. S2CID   6891092. Retrieved 21 January 2021.
  20. Griesemer, Robert (1993). "A Language for Numerical Applications on Vector Computers". Proceedings CONPAR 90: VAPP IV Conference, Diss Nr. 10277. ETH Zurich.