Occam (programming language)


Occam (programming language)

Infobox programming language
name = occam
logo =
paradigm = concurrent
year = 1983
designer =
developer = INMOS
latest release version = 2.1 (official), 2.5 (unofficial), 3 (not fully implemented)
latest release date = 1988+
typing =
implementations =
dialects = occam-π (pi)
influenced_by = Communicating Sequential Processes
influenced = Ease

occam is a concurrent programming language that builds on the Communicating Sequential Processes (CSP) process algebra,cite book | last=INMOS | authorlink=INMOS | url=http://www.wotug.org/occam/documentation/oc21refman.pdf|title=occam 2.1 Reference Manual|publisher=SGS-THOMSON Microelectronics Ltd|date=1995-05-12 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 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 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 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 1cite book | last=INMOS | authorlink=INMOS | |title=occam Programming Manual|publisher=Prentice-Hall|date=1984|id=ISBN 0-13-629296-8] (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 2cite book | last=Ericsson-Zenith | authorlink=Steven Ericsson-Zenith | |title=occam 2 Reference Manual|publisher=Prentice-Hall|date=1988|id=ISBN 0-13-629312-3] 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,Fact|date=June 2007 so there is an existence proof that reasonably sized, useful programs could be written in occam 1, despite its limitations).

occam 2.1

occam 2.1 was the last of the series of occam language developments contributed by INMOS. Defined in 1994, it was influenced by an earlier proposal for an occam 3 language (also referred to as "occam91" during its early development) created by Geoff Barrett at INMOS in the early 1990s. A revised Reference Manual describing occam 3 was distributed for community commentcite paper|author=Geoff Barrett and Steven Ericsson-Zenith|title=occam 3 Reference Manual|url=http://www.wotug.org/occam/documentation/oc3refman.pdf|date=1992-03-31|publisher=INMOS
accessdate=2008-03-24
] , but the language was never fully implemented in a compiler.

occam 2.1 introduced several new features to occam 2, including:

* 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 [http://www.wotug.org/occam/documentation/oc21refman.pdf INMOS occam 2.1 Reference Manual] .

occam-π

occam-πcite web|url=http://www.cs.kent.ac.uk/projects/ofa/kroc/|title=occam-pi: blending the best of CSP and the pi-calculus|author=Fred Barnes and Peter Welch|date=2006-01-14|accessdate=2006-11-24] 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:

*Nested protocols
*Run-time process creation
*Mobile channels, data, and processes
*Recursion
*Protocol inheritance
*Array constructors
*Extended rendezvous

ee also

* Concurrent programming languages

References

Further reading

* [http://www.booksonline.iospress.com/Content/View.aspx?piid=5962]
* [http://www.booksonline.iospress.com/Content/View.aspx?piid=91]
* [http://www.booksonline.iospress.com/Content/View.aspx?piid=56]
*
*

External links

* [http://vl.fmnet.info/occam/ The occam Archive]
* [http://www.occam-pi.org/ The occam-π programming language]
* [http://www.wotug.org/occam/ WoTUG: occam] (Information and Implementations)
* [http://www.transterpreter.org/ The Transterpreter, an occam virtual machine]
* [http://www.cs.kent.ac.uk/projects/ofa/kroc/ KRoC - Kent Retargetable occam Compiler]
* [http://frmb.org/occtutor.html occam tutorial]
* [http://www.wotug.org/parallel/occam/ Internet Parallel Computing Archive: occam] (Documentation and implementations but no longer maintained)


Wikimedia Foundation. 2010.

Look at other dictionaries:

  • occam (programming language) — Not to be confused with OCaml. occam Paradigm(s) concurrent Appeared in 1983 Developer INMOS Stable release 2.1 (official), 2.5 (unofficial), 3 (not fully implemented) (1988+) …   Wikipedia

  • Ease (programming language) — Infobox programming language name = Ease logo = paradigm = concurrent year = 1990 designer = Steven Ericsson Zenith developer = latest release version = latest release date = typing = implementations = various dialects = C with Ease, Carnap… …   Wikipedia

  • Miranda (programming language) — Miranda Paradigm(s) lazy, functional, declarative Appeared in 1985 Designed by David Turner Developer …   Wikipedia

  • SR (programming language) — SR (short for Synchronizing Resources) is a programming language designed for concurrent programming. Resources encapsulate processes and the variables they share, and can be separately compiled. Operations provide the primary mechanism for… …   Wikipedia

  • Curly bracket programming language — Curly brace or bracket programming languages are those which use balanced brackets ({ and }, also known as squiggly brackets , brace brackets or simply braces ) to make blocks in their syntax or formal grammar, mainly due to being C influenced.… …   Wikipedia

  • occam-π — In computer science, occam π (or occam pi) is the name of a variant of the occam programming language developed by the Kent Retargetable occam Compiler (KRoC) team at the University of Kent.[1] The name reflects the introduction of elements of… …   Wikipedia

  • Occam's razor — For the aerial theatre company, see Ockham s Razor Theatre Company. It is possible to describe the other planets in the solar system as revolving around the Earth, but that explanation is unnecessarily complex compared to the modern consensus… …   Wikipedia

  • Programming Research Group — The Programming Research Group (PRG) is part of the Oxford University Computing Laboratory (OUCL). It was founded by Christopher Strachey in 1965 and after his untimely death, C.A.R. Hoare, FRS took over the leadership in 1977. The PRG ethos is… …   Wikipedia

  • Occam-π — In computer science, occam π (or occam pi) is the name of a variant of the occam developed by the Kent Retargetable occam Compiler (KRoC) team at the University of Kent.cite web|url=http://www.cs.kent.ac.uk/projects/ofa/kroc/|title=occam pi:… …   Wikipedia

  • List of programming languages by category — Programming language lists Alphabetical Categorical Chronological Generational This is a list of programming languages grouped by category. Some languages are listed in multiple categories. Contents …   Wikipedia