Occam (programming language): Difference between revisions

Content deleted Content added
Undid revision 1002869486 by Amazing articles (talk) It is true that INMOS themselves did not make an own logo of occam, but they did do registered trademarks of the names "occam" and "occam 2". Scans from the covers of the two "occam books" collected into one has instead been made and then will represent occam like a logo, as by INMOS usage in 1983, 1988. –~~~~
BrainStack (talk | contribs)
Link suggestions feature: 3 links added.
 
(9 intermediate revisions by 9 users not shown)
Line 1:
{{Short description|Concurrent programming language}}
{{distinguishDistinguish|OCaml}}
[[File:1983 1988 Trademark occam and occam 2 INMOS Limited.jpg|thumb]]
{{lowercase title|occam (programming language)}}
{{Infobox programming language
| name = occam
[[File:| logo = 1983 1988 Trademark occam and occam 2 INMOS Limited.jpg|thumb]]
| logo =
| paradigm = [[Imperative programming|Imperative]], [[Procedural programming|procedural]], [[Concurrent computing|concurrent]]
| designer = [[David May (computer scientist)|David May]]
Line 20:
'''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.
 
occamOccam 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]].
 
==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 (programming language)|Haskell]] and [[Python (programming language)|Python]].
 
Communication between processes work through named ''[[Channel (programming)|channels]]''. One process outputs data to a channel via <code>!</code> while another one inputs data with <code>?</code>. 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 ''[[Blocking (computing)|blockblocks]]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
Line 43:
q()
 
<code>ALT</code> specifies a list of ''[[Guard (computer science)|guarded]]'' commands. The ''guards'' are a combination of a booleanBoolean 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
Line 63:
==Language revisions==
[[File:1983 Programming manual occam by INMOS Limited.jpg|thumb|1983 "occam" by INMOS Limited]]
 
===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 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.
 
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===
Line 78 ⟶ 79:
*Named records
*Packed records
*Relaxation of some of the [[type conversion]] rules
*New operators (e.g. BYTESIN)
*Channel retyping and channel arrays
Line 96 ⟶ 97:
 
==See also==
* The [[XC programming language]], which is based on occam but with C-style syntax.
* [[Concurrent computing#Languages supporting concurrent programming|Concurrent programming languages]]
* [[List of concurrent and parallel programming languages]]
Line 109 ⟶ 110:
*{{cite book |editor-last=Kerridge |editor-first=Jon |title=Transputer and Occam Research: New Directions |year=1993 |publisher=IOS Press |isbn=0-8247-0711-7 |pages=[https://archive.org/details/insulintherapy00will/page/253 253 pages] |url-access=registration |url=https://archive.org/details/insulintherapy00will/page/253 }}
*{{cite book |last1=Roscoe |first1=Andrew William |author-link1=Bill Roscoe |last2=Hoare |first2=Charles Antony Richard |author-link2=Tony Hoare |title=The Laws of Occam Programming |year=1986 |publisher=Programming Research Group, Oxford University}}
*Egorov, A., Technical University – Sofia, (1983-20111983–2011) '''Записки по Компютърни архитектури'''
 
== External links ==
Line 118 ⟶ 119:
* [http://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.
 
{{Authority control}}
 
[[Category:Concurrent programming languages]]