Occam (Programming Language)

栏目: IT技术 · 发布时间: 4年前

内容简介:occam is animperative procedural language (such asPascal). It was developed byDavid May and others atInmos (trademark INMOS), advised byTony Hoare, as the native programming language for theirtransputer microprocessors, but implementations for other platfo
occam
Paradigm Imperative , procedural , concurrent
Designed by David May
Developer Inmos
First appeared 1983 ; 37 years ago
Stable release

2.1 (official), 2.5 (unofficial), 3 (not fully implemented) / 1994 ; 26 years ago

Dialects
occam-π (pi)
Influenced by
Communicating sequential processes
Influenced
Ease , Go , Python

occam is aprogramming language which isconcurrent and builds on the communicating sequential processes (CSP) process algebra,and shares many of its features. It is named after philosopherWilliam of Ockham after whomOccam's razor is named.

occam is animperative procedural language (such asPascal). It was developed byDavid May and others atInmos (trademark INMOS), advised byTony Hoare, as the native programming language for theirtransputer 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 atInmos.

Contents

Overview [ edit ]

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 theoff-side rule, is also found in other languages such asHaskell andPython.

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 [ edit ]

occam 1 [ edit ]

occam 1 (released 1983) was a preliminary version of the language which borrowed fromDavid 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 [ edit ]

occam 2 is an extension produced by Inmos Ltd in 1987 that addsfloating-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,so there is an existence proof that reasonably sized, useful programs could be written in occam 1, despite its limits).

occam 2.1 [ edit ]

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-π [ edit ]

occam-π 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:

  • Nested protocols
  • Run-time process creation
  • Mobile channels, data, and processes
  • Recursion
  • Protocolinheritance
  • Arrayconstructors
  • Extendedrendezvous

See also [ edit ]

References [ edit ]

  1. occam 2.1 Reference Manual (PDF) . SGS-Thomson Microelectronics Ltd. 1995-05-12. Inmos document 72 occ 45 03
  2. occam Programming Manual . Prentice-Hall. 1984.ISBN  0-13-629296-8 .
  3. Ericsson-Zenith, Steven (1988). occam 2 Reference Manual . Prentice-Hall.ISBN  0-13-629312-3 .
  4. Cook, Barry M; Peel, RMA (1999-04-11). "Occam on Field-Programmable Gate Arrays" . In Cook, Barry M. (ed.). Architectures, Languages and Techniques for Concurrent Systems . 22nd World Occam and Transputer User Group Technical Meeting. Keele, United Kingdom: IOS Press. p. 219.ISBN  90 5199 480 X . Retrieved 2016-11-28 .
  5. Barrett, Geoff; Ericsson-Zenith, Steven (1992-03-31). "occam 3 Reference Manual" (PDF) . Inmos . Retrieved 2008-03-24 . Cite journal requires |journal= ( help )
  6. Barnes, Fred; Welch, Peter (2006-01-14). "occam-pi: Blending the best of CSP and the pi-calculus" . Retrieved 2006-11-24 .

Further reading [ edit ]

External links [ edit ]

This article is based on material taken from the Free On-line Dictionary of Computing prior to 1 November 2008 and incorporated under the "relicensing" terms of theGFDL, version 1.3 or later.


以上所述就是小编给大家介绍的《Occam (Programming Language)》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

性能之巅

性能之巅

Brendan Gregg / 徐章宁、吴寒思、陈磊 / 电子工业出版社 / 2015-8-15 / 128

《性能之巅:洞悉系统、企业与云计算》基于Linux 和Solaris 系统阐述了适用于所有系统的性能理论和方法,Brendan Gregg 将业界普遍承认的性能方法、工具和指标收集于本书之中。阅读本书,你能洞悉系统运作的方式,学习到分析和提高系统与应用程序性能的方法,这些性能方法同样适用于大型企业与云计算这类最为复杂的环境的性能分析与调优。一起来看看 《性能之巅》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具