Component Pascal
Encyclopedia
Component Pascal is a programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 in the tradition of Niklaus Wirth
Niklaus Wirth
Niklaus Emil Wirth is a Swiss computer scientist, best known for designing several programming languages, including Pascal, and for pioneering several classic topics in software engineering. In 1984 he won the Turing Award for developing a sequence of innovative computer languages.-Biography:Wirth...

's Pascal, Modula-2
Modula-2
Modula-2 is a computer programming language designed and developed between 1977 and 1980 by Niklaus Wirth at ETH Zurich as a revision of Pascal to serve as the sole programming language for the operating system and application software for the personal workstation Lilith...

, Oberon and Oberon-2. It bears the name of the Pascal programming language but is incompatible with it. Instead, it is a minor variant and refinement of Oberon-2, designed and supported by a small ETH Zürich
ETH Zurich
The Swiss Federal Institute of Technology Zurich or ETH Zürich is an engineering, science, technology, mathematics and management university in the City of Zurich, Switzerland....

 spin-off company called Oberon microsystems. Their IDE (Integrated Development Environment
Integrated development environment
An integrated development environment is a software application that provides comprehensive facilities to computer programmers for software development...

) is called BlackBox Component Builder
BlackBox Component Builder
BlackBox Component Builder is an integrated development environment optimized for component-based software development. It consists of development tools, a library of reusable components, a framework that simplifies the development of robust custom components and applications, and a run-time...

. At the time the first version was released (1994 as Oberon/F) it presented a novel approach to graphical user interface
Graphical user interface
In computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...

 (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 XAML
XAML
Extensible Application Markup Language is a declarative XML-based language created by Microsoft used for initializing structured values and objects. It is available under Microsoft's Open Specification Promise...

.

An Open Source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

 implementation exists for the .NET and Java Virtual Machine
Java Virtual Machine
A Java virtual machine is a virtual machine capable of executing Java bytecode. It is the code execution component of the Java software platform. Sun Microsystems stated that there are over 4.5 billion JVM-enabled devices.-Overview:...

 platforms, from the Gardens Point team around John Gough at Queensland University of Technology
Queensland University of Technology
Queensland University of Technology is an Australian university with an applied emphasis in courses and research. Based in Brisbane, it has 40,000 students, including 6,000 international students, over 4,000 staff members, and an annual budget of more than A$750 million.QUT is marketed as "A...

 in Australia.

On June 23, 2004 Oberon Microsystems announced that the BlackBox Component Builder was made available as a free download and that an open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

 version was planned. The beta open source version was initially released in December, 2004 and updated to a final v1.5 release in December, 2005. It includes the complete source code of the IDE, compiler, debugger, source analyser, profiler and interfacing libraries and can also be downloaded from their website. Several release candidates for v1.6 appeared in the years 2009 - 2011, the latest one (1.6rc6) appeared on Oberon Microsystems web pages in 2011.

BlackBox Component Pascal uses the extensions .odc (= Oberon document) for document files, such as source files for example, and .osf (= Oberon symbol file) for symbol files while Gardens Point Component Pascal uses .cp for source and .cps for symbol files. BlackBox Component Pascal has its own executable and loadable object format .ocf (= Oberon code file); it includes a runtime linking loader for this format.

Syntax

The full syntax for CP, as given by the Language Report, is shown below. Note that in the extended Backus–Naur form
Extended Backus–Naur form
In computer science, Extended Backus–Naur Form is a family of metasyntax notations used for expressing context-free grammars: that is, a formal way to describe computer programming languages and other formal languages. They are extensions of the basic Backus–Naur Form metasyntax notation.The...

 only 34 grammatical productions are required, just one more than for Oberon-2
Oberon-2
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....

, although it is a rather more advanced language.


Module = MODULE ident ";"
[ImportList] DeclSeq
[BEGIN StatementSeq]
[CLOSE StatementSeq]
END ident ".".

ImportList = IMPORT [ident ":="] ident {"," [ident ":="] ident} ";".

DeclSeq = { CONST {ConstDecl ";" }
| TYPE {TypeDecl ";"}
| VAR {VarDecl ";"}}
{ ProcDecl ";" | ForwardDecl ";"}.

ConstDecl = IdentDef "=" ConstExpr.

TypeDecl = IdentDef "=" Type.

VarDecl = IdentList ":" Type.

ProcDecl = PROCEDURE [Receiver] IdentDef [FormalPars] MethAttributes
[";" DeclSeq [BEGIN StatementSeq]
END ident].

MethAttributes = ["," NEW] ["," (ABSTRACT | EMPTY | EXTENSIBLE)].

ForwardDecl = PROCEDURE "^" [Receiver] IdentDef [FormalPars] MethAttributes.

FormalPars = "(" [FPSection {";" FPSection}] ")" [":" Type].

FPSection = [VAR | IN | OUT] ident {"," ident} ":" Type.

Receiver = "(" [VAR | IN] ident ":" ident ")".

Type = Qualident
| ARRAY [ConstExpr {"," ConstExpr}] OF Type
| [ABSTRACT | EXTENSIBLE | LIMITED] RECORD ["("Qualident")"] FieldList {";" FieldList} END
| POINTER TO Type
| PROCEDURE [FormalPars].

FieldList = [IdentList ":" Type].

StatementSeq = Statement {";" Statement}.

Statement = [ Designator ":=" Expr
| Designator ["(" [ExprList] ")"]
| IF Expr THEN StatementSeq
{ELSIF Expr THEN StatementSeq}
[ELSE StatementSeq]
END
| CASE Expr OF
Case {"|" Case}
[ELSE StatementSeq]
END
| WHILE Expr DO StatementSeq END
| REPEAT StatementSeq UNTIL Expr
| FOR ident ":=" Expr TO Expr [BY ConstExpr] DO StatementSeq END
| LOOP StatementSeq END
| WITH [ Guard DO StatementSeq ]
{"|" [ Guard DO StatementSeq ] }
[ELSE StatementSeq]
END
| EXIT
| RETURN [Expr]
].

Case = [CaseLabels {"," CaseLabels} ":" StatementSeq].

CaseLabels = ConstExpr [".." ConstExpr].

Guard = Qualident ":" Qualident.

ConstExpr = Expr.

Expr = SimpleExpr [Relation SimpleExpr].

SimpleExpr = ["+" | "-"] Term {AddOp Term}.

Term = Factor {MulOp Factor}.

Factor = Designator | number | character | string | NIL | Set | "(" Expr ")" | " ~ " Factor.

Set = "{" [Element {"," Element}] "}".

Element = Expr [".." Expr].

Relation = "=" | "#" | "<" | "<=" | ">" | ">=" | IN | IS.

AddOp = "+" | "-" | OR.

MulOp = "*" | "/" | DIV | MOD | "&".

Designator = Qualident {"." ident
| "[" ExprList "]"
| "^"
| "(" Qualident ")"
| "(" [ExprList] ")"} [ "$" ].

ExprList = Expr {"," Expr}.

IdentList = IdentDef {"," IdentDef}.

Qualident = [ident "."] ident.

IdentDef = ident ["*" | "-"].


External links


Evolution of Oberon and Oberon-2

  • "[ftp://ftp.inf.ethz.ch/pub/software/Oberon/OberonV4/Docu/ModToOberon.ps.gz From Modula-2 to Oberon]" Wirth (1988)
  • "[ftp://ftp.inf.ethz.ch/pub/software/Oberon/OberonV4/Docu/OberonReport.ps.gz The Programming Language Oberon]" Wirth (1988)
  • "[ftp://ftp.inf.ethz.ch/pub/software/Oberon/OberonV4/Docu/Oberon2.Differences.ps.gz Differences between Oberon and Oberon-2]" Mössenböck and Wirth (1991)
  • "The Programming Language Oberon-2" H. Mössenböck, N. Wirth, Institut für Computersysteme, ETH Zürich, January 1992
  • "What's New in Component Pascal" (Changes from Oberon-2 to CP), Pfister (2001)
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK