Component Pascal

Print Print
Reading time 6:0

Component Pascal
ParadigmsImperative, structured, modular, object-oriented
FamilyWirth Oberon
DeveloperOberon microsystems
First appeared1997; 24 years ago (1997)
Typing disciplineStrong, static
ScopeLexical
Websiteblackboxframework.org
Influenced by
Pascal, Oberon, Oberon-2

Component Pascal is a programming language in the tradition of Niklaus Wirth's Pascal,[1]Modula-2,[2]Oberon[3][4] and Oberon-2.[5] It bears the name of the language Pascal and preserves its heritage, but is incompatible 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 named Oberon/L, and was designed and supported by a small ETH Zürich spin-off company named Oberon microsystems. They developed an integrated development environment (IDE) named BlackBox Component Builder. Since 2014, development and support has been taken over by a small group of volunteers. The first version of the IDE was released in 1994, as Oberon/F. At the time, it presented a novel approach to graphical user interface (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 Extensible Application Markup Language (XAML), which was released in 2008.

An open-source software implementation of Component Pascal exists for the .NET and Java virtual machine (JVM) 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 (1.6rc6) appeared on Oberon microsystems web pages in 2011. At the end of 2013, Oberon microsystems released the final release 1.6. It is probably the last release bundled by them. A small community took over the ongoing development.

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. The document format (.odc) 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.[6]

Syntax

The full syntax for CP, as given by the Language Report, is shown below. In the extended Backus–Naur form, only 34 grammatical productions are needed, one more than for Oberon-2, although it is a 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 ["*" | "-"].

References

  1. ^ Jensen, Kathleen; Wirth, Niklaus (1974–1991). Pascal: User Manual And Report. Springer Verlag. ISBN 978-0-387-97649-5.
  2. ^ Wirth, Niklaus (1982–1985). Programming in Modula-2. Springer Verlag. ISBN 978-3-540-15078-7.
  3. ^ Reiser, Martin; Wirth, Niklaus (1 June 1992). Programming in Oberon: Steps Beyond Pascal and Modula. Addison-Wesley. ISBN 978-0201565430. PDF (334 KB) Archived 3 June 2012 at the Wayback Machine
  4. ^ Wirth, Niklaus; Gutknecht, Jürg (1 November 1992). Project Oberon: The Design of an Operating System and Compiler. Addison-Wesley. ISBN 978-0201544282. PDF (4'398 KB) Archived 10 July 2012 at the Wayback Machine
  5. ^ Mössenböck, Hans-Peter; Wirth, Niklaus (1991). "The Programming Language Oberon-2" (PDF). Structured Programming. 12: 179–195.
  6. ^ Mössenböck, H.; Koskimies, K. (1996). "Active Text for Structuring and Understanding Source Code". Software: Practice and Experience. 26: 833–850. doi:10.1002/(SICI)1097-024X(199607)26:7<833::AID-SPE34>3.0.CO;2-Q.

Further reading

By: Wikipedia.org
Edited: 2021-06-18 18:12:28
Source: Wikipedia.org