Opentopia Directory Encyclopedia Tools

Occam programming language

Encyclopedia : O : OC : OCC : Occam programming language



 

Not to be confused with the Ocaml language.
Occam (officially written in lowercase as occam) is a parallel programming language that builds on the Communicating Sequential Processes (CSP) formalism, and shares many of its features. It is named after William of Ockham of Occam's Razor fame. Occam is, in a way, a practical executable implementation of CSP.

Occam is an imperative procedural language (such as Pascal). It was developed by INMOS as the native programming language for their line of transputer microprocessors, but implementations for other platforms exist as well.

Overview

In the following examples indentation and formatting are critical for parsing the code: expressions are terminated by the end of the line, lists of expressions need to be on the same level of indentation (this feature, also known as the off-side rule, is also found in other languages).

Communication between processes work through named channels. One process outputs data to a channel via ! while another one inputs data with ?. Input and output will block until the other end is ready to accept or offer data. Examples (c is a variable):

keyboard ? c
screen ! c

SEQ introduces a list of expressions that are evaluated sequentially. This is not implicit as it is in most other programming languages. Example:

SEQ
x := x + 1
y := x * x
PAR begins a list of expressions that may be evaluated concurrently. Example:

PAR
p()
q()
ALT specifies a list of guarded commands. The guards are combination of a boolean condition and an input expression (both optional). Each guard for which the condition is true and the input channel is ready is successful. One of the successful alternatives is selected for execution. Example:

ALT
count1 < 100 & c1 ? data
SEQ
count1 := count1 + 1
merged ! data
count2 < 100 & c2 ? data
SEQ
count2 := count2 + 1
merged ! data
status ? request
SEQ
out ! count1
out ! count2
This will read data from channels c1 or c2 (whichever is ready) and pass it into a merged channel. If countN reaches 100, reads from the corresponding channel will be disabled. A request on the status channel is answered by outputting the counts to out.

Language revisions

occam 1

Occam 1 (released 1983) was a preliminary version of the language. This supported only the VAR data type, which was an integral type corresponding to the native word length of the target architecture, and arrays of only one dimension.

occam 2

Occam 2 is an extension produced by INMOS Ltd in 1987 that adds floating-point support, functions, multi-dimensional arrays and more data types such as varying sizes of integers (INT16, INT32) and bytes.

With this revision, occam became a language capable of expressing useful programs, whereas occam 1 was more suited to examining algorithms and exploring the new language.

["occam 2 Reference Manual", INMOS, P-H 1988, ISBN 0-13-629312-3].

occam 2.1

Occam 2.1 is a second enhancement to occam, produced in 1988 by INMOS Ltd. It was the last of the series of language developments contributed by INMOS. Despite its "incremental" version number, it was a significant upgrade in the usefulness of the language, introducing:

For a full list of the changes see Appendix P of the [INMOS occam 2.1 Reference Manual].

occam 3

Occam 3 was the name for a proposal for the next-generation occam language, created by one of the senior programmers at INMOS. A specification was created and distributed for community comment. The new language included a large number of changes, many of which were focussed at making code sharing, simultaneous development, and project reuse easier.

The [occam 3] specification is available, but no compiler was created for this variant of the language, partly due to problems within INMOS and its subsequent takeover.

Some elements from occam 3 were introduced into the occam 2.1 compiler by other teams, and came to be known as 'occam 2.5' - as in "half-way there"!

occam-pi

Occam-pi is the common name for the language compiled by the Kent Retargetable occam Compiler KRoC. It contains a significant number of extensions to the occam 2.1 compiler, for example:

The KRoC team have made the compiler available on their website. In recent times, the team has decided to rename the language compiled by KRoC to occam-pi, because of the use of theories from the Pi-calculus, and also to indicate that the language has been extended significantly compared to the original occam language.

See also

External links


This article was originally based on material from the Free On-line Dictionary of Computing, which is [Foldoc licenselicensed] under the GFDL.

 


From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.


Search Titles
0123456789
ABCDEFGHIJ
KLMNOPQRST
UVWXYZ?

E-mail this article to:

Personal Message: