Occam (programming language)
Encyclopedia
occam is a concurrent
Concurrent computing
Concurrent computing is a form of computing in which programs are designed as collections of interacting computational processes that may be executed in parallel...

 programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 that builds on the Communicating Sequential Processes
Communicating sequential processes
In computer science, Communicating Sequential Processes 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 process calculi...

 (CSP) process algebra, and shares many of its features. It is named after William of Ockham
William of Ockham
William of Ockham was an English Franciscan friar and scholastic philosopher, who is believed to have been born in Ockham, a small village in Surrey. He is considered to be one of the major figures of medieval thought and was at the centre of the major intellectual and political controversies of...

 of Occam's Razor
Occam's razor
Occam's razor, also known as Ockham's razor, and sometimes expressed in Latin as lex parsimoniae , is a principle that generally recommends from among competing hypotheses selecting the one that makes the fewest new assumptions.-Overview:The principle is often summarized as "simpler explanations...

 fame.

occam is an imperative procedural language (such as Pascal
Pascal (programming language)
Pascal is an influential imperative and procedural programming language, designed in 1968/9 and published in 1970 by Niklaus Wirth as a small and efficient language intended to encourage good programming practices using structured programming and data structuring.A derivative known as Object Pascal...

). It was developed by David May
David May (computer scientist)
Michael David May, born February 24, 1951, is a British computer scientist. He is Professor of Computer Science at the University of Bristol and founder and Chief Technology Officer of XMOS Semiconductor.May was lead architect for the transputer...

 and others at INMOS
INMOS
Inmos Limited was a British semiconductor company, founded by Iann Barron, with both the head office and the design office at Aztec West in Bristol, it was incorporated in November 1978.- Products :...

, advised by Tony Hoare, as the native programming language for their transputer microprocessor
Microprocessor
A microprocessor incorporates the functions of a computer's central processing unit on a single integrated circuit, or at most a few integrated circuits. It is a multipurpose, programmable device that accepts digital data as input, processes it according to instructions stored in its memory, and...

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
INMOS
Inmos Limited was a British semiconductor company, founded by Iann Barron, with both the head office and the design office at Aztec West in Bristol, it was incorporated in November 1978.- Products :...

.

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
Off-side rule
A computer programming language is said to adhere to the off-side rule if the scope of declarations in that language is expressed by their indentation. The term and the idea are attributed to Peter J. Landin, and the term can be seen as a pun on the offside law of football .- Definition :Peter J...

, is also found in other languages such as Haskell
Haskell (programming language)
Haskell is a standardized, general-purpose purely functional programming language, with non-strict semantics and strong static typing. It is named after logician Haskell Curry. In Haskell, "a function is a first-class citizen" of the programming language. As a functional programming language, the...

 and Python
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

.

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.

occam 1

occam 1 (released 1983) was a preliminary version of the language which borrowed from David May
David May (computer scientist)
Michael David May, born February 24, 1951, is a British computer scientist. He is Professor of Computer Science at the University of Bristol and founder and Chief Technology Officer of XMOS Semiconductor.May was lead architect for the transputer...

'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 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 (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 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 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 the INMOS occam 2.1 Reference Manual.

occam-π

occam-π is the common name for the occam variant implemented by later versions of KRoC
KRoC
KRoC, the Kent Retargetable occam Compiler, is an occam implementation that is based on the INMOS occam 2.1 compiler as a front-end and a retargetable back-end to produce machine code for various microprocessors...

, the Kent Retargetable occam Compiler. The addition of the symbol "π
Pi (letter)
Pi is the sixteenth letter of the Greek alphabet, representing . In the system of Greek numerals it has a value of 80. Letters that arose from pi include Cyrillic Pe , Coptic pi , and Gothic pairthra .The upper-case letter Π is used as a symbol for:...

" (pi) to the occam name is an allusion to the fact that KRoC occam includes several ideas inspired by the Pi-calculus
Pi-calculus
In theoretical computer science, the π-calculus is a process calculus originally developed by Robin Milner, and David Walker as a continuation of work on the process calculus CCS...

. 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
    Recursion (computer science)
    Recursion in computer science is a method where the solution to a problem depends on solutions to smaller instances of the same problem. The approach can be applied to many types of problems, and is one of the central ideas of computer science....

  • Protocol inheritance
  • Array
    Array data type
    In computer science, an array type is a data type that is meant to describe a collection of elements , each selected by one or more indices that can be computed at run time by the program. Such a collection is usually called an array variable, array value, or simply array...

     constructors
    Constructor (computer science)
    In object-oriented programming, a constructor in a class is a special type of subroutine called at the creation of an object. It prepares the new object for use, often accepting parameters which the constructor uses to set any member variables required when the object is first created...

  • Extended rendezvous

See also

  • Concurrent programming languages
  • Communicating Sequential Processes
    Communicating sequential processes
    In computer science, Communicating Sequential Processes 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 process calculi...


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
  • Egorov, A., Technical University - Sofia, (1983-2011)Записки по Компютърни архитектури

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK