Occam (programming language): Difference between revisions

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
imported>Trdta4
m capitalize occam --> Occam
 
imported>SchlurcherBot
m Bot: http → https
 
Line 18: Line 18:
}}
}}


'''occam''' is a [[programming language]] which is [[Concurrent computing|concurrent]] and builds on the [[communicating sequential processes]] (CSP) process algebra,<ref name="oc21refman">{{cite book |author=<!--Must be person--> |author-link=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</ref> and shares many of its features. It is named after philosopher [[William of Ockham]] after whom [[Occam's razor]] is named.
'''occam''' is a [[programming language]] which is [[Concurrent computing|concurrent]] and builds on the [[communicating sequential processes]] (CSP) process algebra,<ref name="oc21refman">{{cite book |author=<!--Must be person--> |author-link=Inmos |url=https://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</ref> and shares many of its features. It is named after philosopher [[William of Ockham]] after whom [[Occam's razor]] is named.


Occam is an [[Imperative programming|imperative]] [[Procedural programming|procedural]] language (such as [[Pascal (programming language)|Pascal]]). It was developed by [[David May (computer scientist)|David May]] and others at [[Inmos]] (trademark INMOS), advised by [[Tony Hoare]], as the native programming language for their [[transputer]] [[microprocessor]]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]].
Occam is an [[Imperative programming|imperative]] [[Procedural programming|procedural]] language (such as [[Pascal (programming language)|Pascal]]). It was developed by [[David May (computer scientist)|David May]] and others at [[Inmos]] (trademark INMOS), advised by [[Tony Hoare]], as the native programming language for their [[transputer]] [[microprocessor]]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]].
Line 65: Line 65:


===occam 1===
===occam 1===
''occam 1''<ref name="oc1refman">{{cite book |author=<!--Must be person--> |author-link=Inmos |title=occam Programming Manual |publisher=Prentice-Hall |year=1984 |isbn=0-13-629296-8}}</ref> (released 1983) was a preliminary version of the language which borrowed from [[David May (computer scientist)|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 1''<ref name="oc1refman">{{cite book |author=<!--Must be person--> |author-link=Inmos |title=occam Programming Manual |publisher=Prentice-Hall |year=1984 |isbn=0-13-629296-8}}</ref> (released 1983) was a preliminary version of the language which borrowed from [[David May (computer scientist)|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===
''occam 2''<ref name="oc2refman">{{cite book |last=Ericsson-Zenith |first=Steven |title=occam 2 Reference Manual |publisher=Prentice-Hall |year=1988 |isbn=0-13-629312-3}}</ref> 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.
''occam 2''<ref name="oc2refman">{{cite book |last=Ericsson-Zenith |first=Steven |title=occam 2 Reference Manual |publisher=Prentice-Hall |year=1988 |isbn=0-13-629312-3}}</ref> 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 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,<ref name="cook1">{{cite conference |url=https://books.google.com/books?id=nvnnZtJWAZkC&q=architectures+languages+and+techniques+barry+cook |title= Occam on Field-Programmable Gate Arrays |last1=Cook |first1=Barry M |last2=Peel |first2=RMA |date=1999-04-11 |conference=22nd World Occam and Transputer User Group Technical Meeting |editor-last=Cook |editor-first=Barry M. |book-title=Architectures, Languages and Techniques for Concurrent Systems |publisher=IOS Press |location=Keele, United Kingdom |isbn= 90-5199-480-X |page=219 |access-date=2016-11-28}}</ref> so there is an existence proof that reasonably sized, useful programs could be written in occam 1, despite its limits).
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,<ref name="cook1">{{cite conference |url=https://books.google.com/books?id=nvnnZtJWAZkC&q=architectures+languages+and+techniques+barry+cook |title= Occam on Field-Programmable Gate Arrays |last1=Cook |first1=Barry M |last2=Peel |first2=RMA |date=1999-04-11 |conference=22nd World Occam and Transputer User Group Technical Meeting |editor-last=Cook |editor-first=Barry M. |book-title=Architectures, Languages and Techniques for Concurrent Systems |publisher=IOS Press |location=Keele, United Kingdom |isbn= 90-5199-480-X |page=219 |access-date=2016-11-28}}</ref> 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===
''occam 2.1''<ref name="oc21refman"/> 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,<ref name="occam3">{{cite journal |last1=Barrett |first1=Geoff |last2=Ericsson-Zenith |first2=Steven |title=occam 3 Reference Manual |url=http://www.wotug.org/occam/documentation/oc3refman.pdf |date=1992-03-31 |publisher=[[Inmos]] |access-date=2008-03-24}}</ref> but the language was never fully implemented in a compiler.
''occam 2.1''<ref name="oc21refman"/> 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,<ref name="occam3">{{cite journal |last1=Barrett |first1=Geoff |last2=Ericsson-Zenith |first2=Steven |title=occam 3 Reference Manual |url=https://www.wotug.org/occam/documentation/oc3refman.pdf |date=1992-03-31 |publisher=[[Inmos]] |access-date=2008-03-24}}</ref> but the language was never fully implemented in a compiler.


occam 2.1 introduced several new features to occam 2, including:
occam 2.1 introduced several new features to occam 2, including:
Line 79: Line 79:
*Named records
*Named records
*Packed records
*Packed records
*Relaxation of some of the type conversion rules
*Relaxation of some of the [[type conversion]] rules
*New operators (e.g. BYTESIN)
*New operators (e.g. BYTESIN)
*Channel retyping and channel arrays
*Channel retyping and channel arrays
*Ability to return fixed-length array from function.
*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].
For a full list of the changes see Appendix P of the [https://www.wotug.org/occam/documentation/oc21refman.pdf Inmos occam 2.1 Reference Manual].


===occam-π===
===occam-π===
''[[occam-π]]''<ref name="kroc">{{cite web |url=http://www.cs.kent.ac.uk/projects/ofa/kroc/ |title=occam-pi: Blending the best of CSP and the pi-calculus |last1=Barnes |first1=Fred |last2=Welch |first2=Peter |date=2006-01-14 |access-date=2006-11-24}}</ref> is the common name for the occam variant implemented by later versions of the Kent Retargetable occam Compiler ([[KRoC]]). The addition of the symbol ''[[Pi (letter)|π]]'' (pi) to the occam name is an allusion to KRoC occam including several ideas inspired by the [[π-calculus]]. It contains several significant extensions to the occam 2.1 compiler, for example:
''[[occam-π]]''<ref name="kroc">{{cite web |url=https://www.cs.kent.ac.uk/projects/ofa/kroc/ |title=occam-pi: Blending the best of CSP and the pi-calculus |last1=Barnes |first1=Fred |last2=Welch |first2=Peter |date=2006-01-14 |access-date=2006-11-24}}</ref> is the common name for the occam variant implemented by later versions of the Kent Retargetable occam Compiler ([[KRoC]]). The addition of the symbol ''[[Pi (letter)|π]]'' (pi) to the occam name is an allusion to KRoC occam including several ideas inspired by the [[π-calculus]]. It contains several significant extensions to the occam 2.1 compiler, for example:
*[[Nesting (computing)|Nested]] [[Protocol (object-oriented programming)|protocols]]
*[[Nesting (computing)|Nested]] [[Protocol (object-oriented programming)|protocols]]
*Run-time process creation
*Run-time process creation
Line 115: Line 115:


* [http://www.wotug.org/occam/ Information, compilers, editors and utilities at the WoTUG occam pages]
* [http://www.wotug.org/occam/ Information, compilers, editors and utilities at the WoTUG occam pages]
* [http://www.wotug.org/parallel/occam/ Compilers, documentation, examples, projects and utilities at the Internet Parallel Computing Archive] (no longer maintained)
* [https://www.wotug.org/parallel/occam/ Compilers, documentation, examples, projects and utilities at the Internet Parallel Computing Archive] (no longer maintained)
* [http://www.transputer.net/obooks/obooks.asp Occam books on Transputer.net]
* [https://www.transputer.net/obooks/obooks.asp Occam books on Transputer.net]
* [http://www.cs.kent.ac.uk/projects/ofa/kroc/ The occam-pi language].
* [https://www.cs.kent.ac.uk/projects/ofa/kroc/ The occam-pi language].
* [http://projects.cs.kent.ac.uk/projects/tock/trac/ Tock occam compiler] – (translator from occam to C from Kent) a Haskell-based compiler for occam and related languages.
* [http://projects.cs.kent.ac.uk/projects/tock/trac/ Tock occam compiler] – (translator from occam to C from Kent) a Haskell-based compiler for occam and related languages.



Latest revision as of 14:19, 14 October 2025

Template:Short description Script error: No such module "Distinguish". Template:Lowercase title Script error: No such module "Infobox".Template:Template otherScript error: No such module "Check for unknown parameters".

occam is a programming language which is concurrent and builds on the communicating sequential processes (CSP) process algebra,[1] and shares many of its features. It is named after philosopher William of Ockham 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, as the native programming language for their transputer microprocessors, 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, is also found in other languages such as Haskell and Python.

Communication between processes work through named channels. 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 blocks 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

File:1983 Programming manual occam by INMOS Limited.jpg
1983 "occam" by INMOS Limited

occam 1

occam 1[2] (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[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 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,[4] 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[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,[5] 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-π[6] is the common name for the occam variant implemented by later versions of the Kent Retargetable occam Compiler (KRoC). The addition of the symbol π (pi) to the occam name is an allusion to KRoC occam including several ideas inspired by the π-calculus. It contains several significant extensions to the occam 2.1 compiler, for example:

See also

References

Template:Reflist

Further reading

  • Script error: No such module "citation/CS1". [1]
  • Script error: No such module "citation/CS1". [2]
  • Script error: No such module "citation/CS1". [3]
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Egorov, A., Technical University – Sofia, (1983–2011) Записки по Компютърни архитектури

External links

Template:Authority control

  1. a b Script error: No such module "citation/CS1". Inmos document 72 occ 45 03
  2. Script error: No such module "citation/CS1".
  3. Script error: No such module "citation/CS1".
  4. Script error: No such module "citation/CS1".
  5. Script error: No such module "Citation/CS1".
  6. Script error: No such module "citation/CS1".