occam is a
programming language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language.
The description of a programming ...
which is
concurrent
Concurrent means happening at the same time. Concurrency, concurrent, or concurrence may refer to:
Law
* Concurrence, in jurisprudence, the need to prove both ''actus reus'' and ''mens rea''
* Concurring opinion (also called a "concurrence"), a ...
and builds on the
communicating sequential processes
In computer science, communicating sequential processes (CSP) is a formal language for describing patterns of interaction in concurrent systems. It is a member of the family of mathematical theories of concurrency known as process algebras, or ...
(CSP) process algebra,
[ Inmos document 72 occ 45 03] and shares many of its features. It is named after philosopher
William of Ockham
William of Ockham, OFM (; also Occam, from la, Gulielmus Occamus; 1287 – 10 April 1347) was an English Franciscan friar, scholastic philosopher, apologist, and Catholic theologian, who is believed to have been born in Ockham, a small vil ...
after whom
Occam's razor is named.
occam is an
imperative procedural language (such as
Pascal). It was developed by
David May and others at
Inmos (trademark INMOS), advised by
Tony Hoare
Sir Charles Antony Richard Hoare (Tony Hoare or C. A. R. Hoare) (born 11 January 1934) is a British computer scientist who has made foundational contributions to programming languages, algorithms, operating systems, formal verification, and ...
, as the native programming language for their
transputer
The transputer is a series of pioneering microprocessors from the 1980s, intended for parallel computing. To support this, each transputer had its own integrated memory and serial communication links to exchange data with other transputers. T ...
microprocessor
A microprocessor is a computer processor where the data processing logic and control is included on a single integrated circuit, or a small number of integrated circuits. The microprocessor contains the arithmetic, logic, and control circ ...
s, 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.
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, named the
off-side rule
A computer programming language is said to adhere to the off-side rule of syntax if blocks in that language are expressed by their indentation. The term was coined by Peter Landin, possibly as a pun on the offside rule in association football ...
, is also found in other languages such as
Haskell
Haskell () is a general-purpose, statically-typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research and industrial applications, Haskell has pioneered a number of programming lan ...
and
Python
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (pro ...
.
Communication between processes work through named ''
channels
Channel, channels, channeling, etc., may refer to:
Geography
* Channel (geography), in physical geography, a landform consisting of the outline (banks) of the path of a narrow body of water.
Australia
* Channel Country, region of outback Austral ...
''. One process outputs data to a channel via
!
while another one inputs data with
?
. Input and output cannot proceed until the other end is ready to accept or offer data. (In the ''not proceeding'' case it is often said that the process ''
block
Block or blocked may refer to:
Arts, entertainment and media Broadcasting
* Block programming, the result of a programming strategy in broadcasting
* W242BX, a radio station licensed to Greenville, South Carolina, United States known as ''96.3 ...
s'' on the channel. However, the program will neither spin nor poll; thus terms like ''wait'', ''hang'' or ''yield'' may also convey the behaviour; also in the context that it will not ''block'' other independent processes from running.) 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 1''
(released 1983) was a preliminary version of the language which borrowed from
David May's work on EPL and Tony Hoare's CSP. 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
In computing, floating-point arithmetic (FP) is arithmetic that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can b ...
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 able to express useful programs, whereas occam 1 was more suited to examining algorithms and exploring the new language (however, the occam 1 compiler was written in occam 1,
so there is an existence proof that reasonably sized, useful programs could be written in occam 1, despite its limits).
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 comment,
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 th
Inmos occam 2.1 Reference Manual
occam-π
''
occam-π
In computer science, occam-π (or occam-pi) is the name of a variant of the programming language occam (programming language), occam developed by the Kent Retargetable occam Compiler (KRoC) team at the University of Kent. The name reflects the in ...
''
is the common name for the occam variant implemented by later versions of the Kent Retargetable occam Compiler (
KRoC
Kroc is a surname. Notable people with the name include:
* Janae Kroc (born 1972), bodybuilder and powerlifter
* Joan Kroc (1929–2003), American philanthropist
* Ray Kroc
Raymond Albert Kroc (October 5, 1902 – January 14, 1984) was an ...
). The addition of the symbol ''
π'' (pi) to the occam name is an allusion to KRoC occam including several ideas inspired by the
π-calculus
In theoretical computer science, the -calculus (or pi-calculus) is a process calculus. The -calculus allows channel names to be communicated along the channels themselves, and in this way it is able to describe concurrent computations whose netw ...
. It contains several significant extensions to the occam 2.1 compiler, for example:
*
Nested
''Nested'' is the seventh studio album by Bronx-born singer, songwriter and pianist Laura Nyro, released in 1978 on Columbia Records.
Following on from her extensive tour to promote 1976's ''Smile'', which resulted in the 1977 live album '' Seas ...
protocols
Protocol may refer to:
Sociology and politics
* Protocol (politics), a formal agreement between nation states
* Protocol (diplomacy), the etiquette of diplomacy and affairs of state
* Etiquette, a code of personal behavior
Science and technology ...
*Run-time process creation
*Mobile channels, data, and processes
*
Recursion
Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathemati ...
*Protocol
inheritance
Inheritance is the practice of receiving private property, Title (property), titles, debts, entitlements, Privilege (law), privileges, rights, and Law of obligations, obligations upon the death of an individual. The rules of inheritance differ ...
*Array
constructors
*Extended
rendezvous
See also
* The
XC programming language, which is based on occam but with C-style syntax.
*
Concurrent programming languages
Concurrent computing is a form of computing in which several computations are executed '' concurrently''—during overlapping time periods—instead of ''sequentially—''with one completing before the next starts.
This is a property of a syst ...
*
List of concurrent and parallel programming languages
This article lists concurrent and parallel programming languages, categorizing them by a defining paradigm. Concurrent and parallel programming languages involve multiple timelines. Such languages provide synchronization constructs whose behavior ...
References
Further reading
*
*
*
*
*
*Egorov, A., Technical University – Sofia, (1983-2011) Записки по Компютърни архитектури
External links
Information, compilers, editors and utilities at the WoTUG occam pagesCompilers, documentation, examples, projects and utilities at the Internet Parallel Computing Archive(no longer maintained)
Occam books on Transputer.netThe occam-pi language
Tock occam compiler– (translator from occam to C from Kent) a Haskell-based compiler for occam and related languages.
{{Authority control
Concurrent programming languages
Procedural programming languages
Programming languages created in 1983