*** Welcome to piglix ***

Occam programming language

occam
Paradigm concurrent
Developer INMOS
First appeared 1983
Stable release
2.1 (official), 2.5 (unofficial), 3 (not fully implemented) / 1988+
Dialects
occam-π (pi)
Influenced by
Communicating Sequential Processes
Influenced
Ease, Go

occam is a concurrent programming language that builds on the communicating sequential processes (CSP) process algebra, and shares many of its features. It is named after William of Ockham of Occam's Razor fame.

occam is an imperative procedural language (such as Pascal). It was developed by David May and others at INMOS, advised by Tony Hoare, as the native programming language for their transputer microprocessors, but implementations for other platforms are available. The most widely known version is occam 2; its programming manual was written by Steven Ericsson-Zenith and others at INMOS.

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, named the off-side rule, is also found in other languages such as Haskell and Python.

Communication between processes work through named channels. One process outputs data to a channel via "!" while another one inputs data with "?". Input and output can not proceed until the other end is ready to accept or offer data. (In the "not proceeding" case it is often said that the process "blocks" on the channel. However, the program will neither spin nor poll; therefore terms like "wait", "hang" or "yield" may also convey the behaviour - also in the light of the fact that it will not "block" other independent processes from running.) Examples (c is a variable):


...
Wikipedia

...