Occam programming language

From Academic Kids

Occam (from William of Ockham of Occam's Razor fame) is a parallel programming language that builds on Communicating Sequential Processes (CSP) and shares many of their features. It is, in a way, a practical executable implementation of CSP.

Occam is an imperative procedural language (such as Pascal). Occam was developed by Inmos for their line of Transputers, but implementations for other platforms exist as well.



Note that in the examples below 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 is also found in other languages, such as Python, Haskell, Icon, NGL, Miranda, and ABC).

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:

   x := x + 1
   y := x * x

PAR begins a list of expressions that may be evaluated concurrently. Example:

   x := x + 1
   y := y * 2

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:

   count1 < 100 & c1 ? data
       count1 := count1 + 1
       merged ! data
   count2 < 100 & c2 ? data
       count2 := count2 + 1
       merged ! data
   status ? request
       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.

Occam 2

Occam 2 is an extension produced by INMOS Ltd in 1987. Occam 2 adds floating-point, functions and more language types. For example, varying sizes of integers (INT16, INT32) and character types.

With this revision it 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 May 1995 by INMOS Ltd. It was the last of the series language developments contributed by INMOS. Despite it's "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 Pecords;
  • 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 the INMOS Occam 2.1 Reference Manual (http://www.wotug.org/occam/documentation/oc21refman.pdf) Appendix P.

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 (http://www.wotug.org/occam/documentation/oc3refman.pdf) 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 2.5

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

  • nested protocols
  • run-time process creation
  • mobile channels, data, and processes
  • recursion;
  • protocol inheritance;
  • array constructors;
  • extended rendezvous.

The KRoC team have made the compiler available on their website. In recent times, the team has decided to rename the compiler to Occam-Pi, because of the use of theories from the Pi-calculus.

External links

fr:Occam (langage) it:Occam (linguaggio)

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

Academic Kids Menu

  • Art and Cultures
    • Art (http://www.academickids.com/encyclopedia/index.php/Art)
    • Architecture (http://www.academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (http://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (http://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)


  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Personal tools