Occam Programming Language Article Index for
Occam
Website Links For
Occam
 

Information About

Occam Programming Language





Programming Information

  name occam
  paradigm Concurrent
  year 1983
  developer INMOS
  latest Release Version 21 (official), 25 (unofficial), 3 (not fully implemented)
  latest Release Date 1988 +
  dialects Occam-π (pi)
  influenced By Communicating Sequential Processes
  influenced Ease


occam is a Concurrent Programming Language that builds on the Communicating Sequential Processes (CSP) formalism,1 INMOS document 72 occ 45 03 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 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; the Occam 2 programming manual was put together by Steven Ericsson-Zenith and others at INMOS .


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
  • 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 a 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 12 (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 23 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 (though it should be noted that the occam 1 compiler was written in occam 1, so there is an existence proof that reasonably sized codes could usefully be written in occam 1, despite its limitations).


occam 2.1


occam 2.1 is a second enhancement to occam, defined in 1994 by INMOS . 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:

  • Named data types (DATA TYPE x IS y)

  • Named Records

  • Packed Records

  • Relaxation of some of the type conversion rules

  • New operators (e.g. BYTESIN)

  • Channel retyping and channel arrays

  • Ability to return fixed-length array from function.


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


occam-π

Occam-π 4 is the common name for the occam variant implemented by later versions of KRoC , the Kent Retargetable occam Compiler. The addition of the symbol " π " (pi) to the occam name is an allusion to the fact that KRoC occam includes several ideas inspired by the Pi-calculus . It contains a significant number of extensions to the occam 2.1 compiler, for example:



SEE ALSO



REFERENCES




FURTHER READING



EXTERNAL LINKS