Occam (programming language)

Occam is an imperative parallel programming language, which is based on Communicating Sequential Processes. It was developed around 1985, among others, David May at the company Inmos and is named after the philosopher and logician William of Ockham (also called Occam ) named. Your use of focus is on the implementation of distributed systems, in particular of transputer systems. Originally it was intended for microprocessors from INMOS, but there is now also available for other platforms.

Basic concept

Occam was named after William of Ockham, since the language in their approach to the principle of Occam's Razor follows. There are only five basic constructs in Occam: sequence, parallelism, alternative, and loop condition. Each of these constructs is a distinct process that consists of individual statements, which are in turn themselves processes. The communication between processes is via channels ( German: channels). With a question mark (?) Channels are read, and with an exclamation mark (!) Data are output on a channel. Comments are introduced with ---. Function blocks are combined by each row of the same feeder is placed in front. The two main constructs of sequence and parallelism will be presented shortly. In particular, the parallelism differs Occam 's sequential programming languages ​​such as C, BASIC or Pascal.

Sequence

A sequence is introduced by the keyword SEQ. Occam behaves within a sequence as a conventional programming language.

SEQ    EKanal? a    b: = a * 5    AKanal! b In the above code fragment, the value from the Channel EKanal is first read and stored in the variable a. Then the variable b of five times the value of a is assigned to the variable b and output to the Channel AKanal. The execution of statements is done sequentially ( sequential).

Parallelism

Parallel to be executed instructions are introduced by the keyword PAR. Each process contains is started at the same time.

PAR    SEQ      EKanal1? a      EKanal2? b      c: = a * b      AKanal1! c    SEQ      EKanal3? x      EKanal4? y      z: = x y      AKanal2! z The whole process consists here of two - SEQ processes which in turn consist of individual statements. The two - SEQ processes are started simultaneously and processed in parallel.

Hello, World! in Occam

PROC HelloWorld ()    [ ] BYTE helloWorldString:    SEQ      helloWorldString: = "Hello, World!"      screen! helloWorldString swell

  • Ralf Steinmetz: OCCAM 2 Hüthig, Heidelberg, 1988, ISBN 3-7785-1654- X.
613205
de