Component Pascal


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 Pascal programming language and it preserves its heritage, but it is not compatible 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 designed and supported by a small ETH Zürich spin-off company called Oberon microsystems under the name Oberon/L. They developed an IDE called BlackBox Component Builder. Since 2014 development and support has been taken over by a small group of volunteers. At the time the first version of the IDE was released it presented a novel approach to graphical user interface 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, which was released in 2008.
An open-source implementation of Component Pascal exists for the.NET and Java Virtual Machine platforms, from the Gardens Point team around John Gough at Queensland University of Technology in Australia.
On 23 June 2004 Oberon microsystems announced that the BlackBox Component Builder was made available as a free download and that an open-source 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 appeared on Oberon microsystems web pages in 2011. At the end of 2013 Oberon Microsystems released the final release 1.6. It is most probably last release bundled by Oberon Microsystems and a small community took over the ongoing development.
BlackBox Component Pascal uses the extensions.odc for document files, such as source files for example, and.osf 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 ; it includes a runtime linking loader for this format. The document format is a rich text binary format, which allows nice formatting, supports conditional folding, and allows active content to be embedded in the source text. It also handles user interface elements in editable forms. This is in tradition of the Oberon Text format.

Syntax

The full syntax for CP, as given by the Language Report, is shown below. Note that in the extended Backus–Naur form only 34 grammatical productions are required, just one more than for Oberon-2, although it is a rather more advanced language.

Module = MODULE ident ";"
DeclSeq


END ident ".".
ImportList = IMPORT ident ";".
DeclSeq =
.
ConstDecl = IdentDef "=" ConstExpr.
TypeDecl = IdentDef "=" Type.
VarDecl = IdentList ":" Type.
ProcDecl = PROCEDURE IdentDef MethAttributes

END ident].
MethAttributes = .
ForwardDecl = PROCEDURE "^" IdentDef MethAttributes.
FormalPars = "" .
FPSection = ident ":" Type.
Receiver = "".
Type = Qualident
| ARRAY OF Type
| RECORD FieldList END
| POINTER TO Type
| PROCEDURE .
FieldList = .
StatementSeq = Statement.
Statement =
| IF Expr THEN StatementSeq


END
| CASE Expr OF
Case

END
| WHILE Expr DO StatementSeq END
| REPEAT StatementSeq UNTIL Expr
| FOR ident ":=" Expr TO Expr DO StatementSeq END
| LOOP StatementSeq END
| WITH


END
| EXIT
| RETURN
].
Case = .
CaseLabels = ConstExpr .
Guard = Qualident ":" Qualident.
ConstExpr = Expr.
Expr = SimpleExpr .
SimpleExpr = Term.
Term = Factor.
Factor = Designator | number | character | string | NIL | Set | "" | " ~ " Factor.
Set = "".
Element = Expr .
Relation = "=" | "#" | "<" | "<=" | ">" | ">=" | IN | IS.
AddOp = "+" | "-" | OR.
MulOp = "*" | "/" | DIV | MOD | "&".
Designator = Qualident .
ExprList = Expr.
IdentList = IdentDef.
Qualident = ident.
IdentDef = ident .