Questions Concepts
GitHub icon

Oberon

Oberon - Programming language

< >

Oberon is a programming language created in 1986 by Niklaus Wirth.

#132on PLDB 37Years Old

Try now: Riju

Oberon is a general-purpose programming language created in 1986 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 the construction of new data types on the basis of existing ones and to relate them, deviating from the dogma of strictly static data typing. Read more on Wikipedia...


Example from Riju:
MODULE Main; IMPORT Out; BEGIN Out.String("Hello, world!"); Out.Ln; END Main.
Example from hello-world:
MODULE HelloWorld; IMPORT Out; BEGIN Out.Open; Out.String('Hello World'); END HelloWorld.
Example from Wikipedia:
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.

Language features

Feature Supported Token Example
Strings '
'Hello world'
Assignment :=
Comments
(* A comment
*)
MultiLine Comments (* *)
(* A comment
*)
Pointers
Print() Debugging Out.String
Semantic Indentation X

View source

- Build the next great programming language · Search · Add Language · Features · Creators · Resources · About · Blog · Acknowledgements · Queries · Stats · Sponsor · Traffic · Traffic Today · Day 305 · feedback@pldb.com · Logout