Oberon (programming language)

Oberonis a general-purposeprogramming languagefirst published in 1987 byNiklaus Wirthand the latest member of the Wirthian family ofALGOL-like languages (Euler,ALGOL W,Pascal,Modula,andModula-2).[1][2][3][4]Oberon was the result of a concentrated effort to increase the power ofModula-2,the direct successor ofPascal,and simultaneously to reduce its complexity. Its principal new feature is the concept ofdata typeextension ofrecordtypes.[5]It permits constructing new data types on the basis of existing ones and to relate them, deviating from the dogma of strictstatic typingof 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 anoperating system,also namedOberonatETH ZurichinSwitzerland.The name was inspired both by the Voyager space probe's pictures of the moon of the planetUranus,namedOberon,and because Oberon is famous as the king of the elves.[6]

Oberon
ParadigmsImperative,structured,modular,object-oriented
FamilyWirthOberon
Designed byNiklaus WirthEdit this on Wikidata
DeveloperNiklaus WirthEdit this on Wikidata
First appeared1987;37 years ago(1987)
Stable release
Oberon-07 / 6 March 2020;4 years ago(2020-03-06)
Typing disciplineStrong,hybrid (staticanddynamic)
ScopeLexical
PlatformARM,StrongARM;IA-32,x86-64;SPARC,Ceres(NS32032)
OSWindows,Linux,Solaris,classic Mac OS,Atari TOS,AmigaOS
Websiteprojectoberon.net
Influenced by
Modula-2
Influenced
Oberon-2,Oberon-07,Active Oberon,Component Pascal,Zonnon,Go,V (Vlang),Nim

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

Design

edit

Oberon is designed with a motto attributed toAlbert Einsteinin 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 asC++andAda.In contrast to these, Oberon emphasizes the use of thelibraryconcept 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 identifierSYSTEMin its import list. Stricttype checking,even across modules, andindex checkingatruntime,null pointerchecking, 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

edit

Features characterizing the Oberon language include:[9]

  • Case sensitive syntax with uppercase keywords
  • Type-extension with type test
  • Modules and separate compiling
  • String operations
  • Isolating unsafe code
  • Support for system programming

Object orientation

edit

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

edit

In this technique, a table ofprocedurevariablesis defined and aglobal variableof this type is declared in the extended module and assigned back in the generic module:

MODULEFigures;(* Abstract module *)

TYPE
Figure* =POINTER TOFigureDesc;
Interface* =POINTER TOInterfaceDesc;

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;

PROCEDUREInit* (f: Figure; if: Interface);
BEGIN
f.if:= if
ENDInit;

PROCEDUREDraw* (f: Figure);
BEGIN
f.if.draw(f)
ENDDraw;

(* Other procedures here *)

ENDFigures.

We extend the generic type Figure to a specific shape:

MODULERectangles;

IMPORTFigures;

TYPE
Rectangle* =POINTER TORectangleDesc;

RectangleDesc* =RECORD
(Figures.FigureDesc)
x, y, w, h:INTEGER;
END;

VAR
if: Figures.Interface;

PROCEDURENew* (VARr: Rectangle);
BEGIN
NEW(r);
Figures.Init(r, if)
ENDNew;

PROCEDUREDraw* (f: Figure);
VAR
r: Rectangle;
BEGIN
r:= f(Rectangle);(* f AS Rectangle *)
(*... *)
ENDDraw;

(* Other procedures here *)

BEGIN(* Module initialisation *)
NEW(if);
if.draw:= Draw;
if.clear:= Clear;
if.mark:= Mark;
if.move:= Move
ENDRectangles.

Dynamic dispatchis only done via procedures in Figures module that is the generic module.

Message handler

edit

This technique consists of replacing the set of methods with a single procedure, which discriminates among the various methods:

MODULEFigures;(* Abstract module *)

TYPE
Figure* =POINTER TOFigureDesc;

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;VARmsg: Message);

FigureDesc* =RECORD
(* Abstract *)
handle: Handler;
END;

PROCEDUREHandle* (f: Figure;VARmsg: Message);
BEGIN
f.handle(f, msg)
ENDHandle;

PROCEDUREInit* (f: Figure; handle: Handler);
BEGIN
f.handle:= handle
ENDInit;

ENDFigures.

We extend the generic type Figure to a specific shape:

MODULERectangles;

IMPORTFigures;

TYPE
Rectangle* =POINTER TORectangleDesc;

RectangleDesc* =RECORD
(Figures.FigureDesc)
x, y, w, h: INTEGER;
END;

PROCEDUREDraw* (r: Rectangle);
BEGIN
(*... *)
ENDDraw;

(* Other procedures here *)

PROCEDUREHandle* (f: Figure;VARmsg: Figures.Message);
VAR
r: Rectangle;
BEGIN
r:= f(Rectangle);
IFmsgISFigures.DrawMsgTHENDraw(r)
ELSIFmsgISFigures.MarkMsgTHENMark(r)
ELSIFmsgISFigures.MoveMsgTHENMove(r, msg(Figures.MoveMsg).dx, msg(Figures.MoveMsg).dy)
ELSE(* ignore *)
END
ENDHandle;

PROCEDURENew* (VARr: Rectangle);
BEGIN
NEW(r);
Figures.Init(r, Handle)
ENDNew;

ENDRectangles.

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

edit

Oberon

edit

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

edit

A few changes were made to the first released specification. For example,object-oriented programming(OOP) features were added, theFORloop was reinstated. The result wasOberon-2.One release, namedNative Oberonwhich includes an operating system, and can directly boot onIBM PC compatibleclass hardware. A.NETimplementation of Oberon with some added minor.NET-related extensions was also developed at ETHZ. In 1993, an ETHZuniversity spin-offcompany brought a dialect of Oberon-2 to the market namedOberon-L.In 1997, it was renamedComponent Pascal.

Oberon-2 compilers developed by ETH include versions forMicrosoft Windows,Linux,Solaris,andclassic Mac OS.Implementations from other sources exist for some other operating systems, includingAtari TOSandAmigaOS.

There is an Oberon-2Lexscanner andYaccparserby Stephen J Bevan of Manchester University, UK, based on the one in theMössenböckand 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 toClanguagesource-to-source compiler(transpiler) named Ofront,[12]which in turn is based on the OP2 Compiler developed by Regis Crelier at ETHZ.

Oberon-07

edit

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.,FLOORandFLT) must be used; theWITH,LOOPandEXITstatements were omitted;WHILEstatements were extended;CASEstatements can be used for type extension tests;RETURNstatements 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 usingCOPY.[13]

Oberon-07 compilers have been developed for use with many different computer systems. Wirth's compiler targets areduced instruction set computer(RISC) processor of his own design that was used to implement the 2013 version of theProject Oberonoperating system on a Xilinxfield-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 andmacOS,and binaries available for Windows) also exist.OBNCcompiles via C and can be used on any Portable Operating System Interface (POSIX) compatible operating system. The commercialAstrobeimplementation targets 32-bit ARM Cortex-M3, M4 and M7 microcontrollers. ThePatchoulicompiler produces 64-bit Windows binaries.Oberon-07Mproduces 32-bit Windows binaries and implements revision 2008 of the language.Akron'sproduces binaries for both Windows and Linux.OberonJStranslates Oberon toJavaScript.There isonline IDE for Oberon.oberoncis an implementation for theJava virtual machine.

Active Oberon

edit

Active Oberonis 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 (namedtype-bound proceduresin 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 (seeOberonX language extensionsand Proceedings[14]of the 7th Joint Modular Languages Conference 2006 Oxford, UK), and knows aboutnamespaces.[15]The operating systemA2(formerlyActive Object System(AOS),[16]thenBluebottle), especially thekernel,synchronizes and coordinates different active objects.

ETHZ has releasedActive Oberonwhich 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, supportedcentral processing units(CPUs) include single and dual corex86,andStrongARM.

edit

Development continued on languages in this family. A further extension of Oberon-2 was originally named Oberon/L but later renamed toComponent Pascal(CP). CP was developed for Windows andclassic Mac OSby Oberon microsystems, a commercial spin-off company from ETHZ, and for.NET byQueensland University of Technology.Further, the languagesLagoona[17][18][19]andObliqcarry Oberon methods into specialized areas.

Later.NET development efforts at ETHZ focused on a new language namedZonnon.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, afterSeneca the Younger) is a descendant of Oberon designed for numerical applications onsupercomputers,especially vector orpipelinedarchitectures. It includes array constructors and anALLstatement.[20]

See also

edit

Resources

edit

General

edit

Evolution of Oberon

edit

References

edit
  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.S2CID13092279.
  4. ^Wirth, Niklaus (April 1988)."Type Extensions".ACM Transactions on Programming Languages.10(2): 204–214.doi:10.1145/42190.46167.S2CID15829497.
  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.Retrieved16 January2021.
  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".Retrieved17 January2021.
  11. ^dcwbrown (16 June 2020)."Vishap Oberon Compiler".GitHub.Retrieved17 January2021.
  12. ^jtempl (2 January 2020)."Ofront".GitHub.Retrieved17 January2021.
  13. ^Wirth, Niklaus (3 May 2016).The Programming Language Oberon-07(PDF).ETH Zurich, Department of Computer Science(Report).Retrieved17 January2021.
  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.ISBN978-3-540-40927-4.S2CID34210781.
  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.Retrieved18 January2021.
  18. ^Fröhlich, Peter H.; Gal, Andreas; Franz, Michael (April 2005)."Supporting software composition at the programming language level".Science of Computer Programming.56(1–2). Elsevier B.V.: 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.ISBN0-7695-0616-X.S2CID6891092.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.