Oberon Oberon is a general-purpose programming language and an operating system of the same name (developed by the Oberon language and also referred to a new generation of network operating system Plan9 of Bell Labs), created and implemented by the inventor Niklaus Wirth of the original Pascal programming language. Developed by Pascal, its syntax is elegant, concise, efficient and easy to use, suitable for many processor applications such as arm. And Oberon can be used to develop system programs and applications.
**1, Design * *
Oberon Design has a motto that is Albert Einstein's idea: "Make things as simple as possible, not simpler." "The approach is to focus attention on those basic and necessary, ignoring the short-term problem characteristics. Another factor is the growing recognition of the complexity of languages such as C + + and Ada: Relative to these, Oberon emphasizes the use of the library concept of extended language. enumerations, sub-bounds types, which are currently in Modula-2, have been deleted; Similarly, the set type has been limited to small integers, and the number of underlying facilities has been significantly reduced (most notably, the type transfer function has been eliminated). The remaining potential for the elimination of unsafe facilities is the most important step towards obtaining a truly high-level language. very close even to cross- module type checking, check for strict metrics at runtime, null pointer checks , and security type extensions Concept to a large extent allows programmers to rely on language rules .
The aim of this strategy is to produce a language that is easier to learn, easy to implement, and very effective. The Oberon compiler has been considered to be compact and fast , while providing enough code quality compared to commercial compilers .
**2, Features * *
1, method and keyword capitalization -sensitive syntax
2, test type and extended type
3, Separation and mixing modes
4, String manipulation
5, Garbage collector
6, Code separation
7, support system programming
**3, Object-oriented * *
This support is an extension of the construction record type for abstract and heterogeneous structures, but there is no scheduling mechanism as a language feature but a programming technique or design pattern. This gives a great deal of flexibility in the object-oriented world. the two programming techniques in the operating system have been used to connect the dispatch traffic: Methods and message processing methods .
**4, Method Kit * *
example program variable definition and A global variable for the type in the extension module declaration and assign on Universal 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.
By the above example, a general -purpose graphic is extended 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 scheduling is through The program's Data module, the Universal module .
**5, message handlers * *
The technique includes changing the Setup method of a program , the difference between the various methods :
MODULEFigures;(* Abstract module *)TYPEfigure* =POINTER toFiguredesc; 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;VARMsg:message); figuredesc* =RECORD (* Abstract *)Handle:handler;END;PROCEDUREHandle* (f:figure;VARMsg:message);BEGINF.handle (f, msg);ENDHandle;PROCEDUREinit* (f:figure; handle:handler);BEGINF.handle: = handle;ENDInit;ENDFigures.
expands the general diagram to a specific shape :
MODULErectangles;IMPORTFigures;TYPErectangle* =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);VARR:rectangle;BEGINR: = f (Rectangle);IFMsg isFigures.drawmsg ThenDraw (R)elsifMsg isFigures.markmsg ThenMark (R)elsifMsg isFigures.movemsg ThenMove (R, MSG (FIGURES.MOVEMSG). DX, MSG (figures.movemsg). Dy)ELSE(* ignore *)ENDENDHandle;PROCEDUREnew* (VARR:rectangle);BEGIN NEW(r); Figures.init (R, Handle);ENDNew;ENDRectangles.
Introduction to Oberon programming language