Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Barrett G.Occam 3 reference manual.1992

.pdf
Источник:
Скачиваний:
8
Добавлен:
23.08.2013
Размер:
1.56 Mб
Скачать

I Invalid processes

Processes which become invalid during program execution may behave in one of three ways, determined by a compiler option. An invalid process may behave in one of these ways: the process may stop, the system may halt, or the behaviour of the process may be undefined.

The three modes of existence in detail are:

Stop process mode In this mode, processes which become invalid behave like the primitive process STOP, thus allowing other processes to continue. The invalid process stops, and in particular does not make erroneous outputs to other processes. Other processes continue until they become dependent upon data from the stopped process. In this mode it is therefore possible to write communications which will timeout to warn of a stopped process, and to construct a system with redundancy in which a number of processes performing the same task may be used to enable the system to continue after one of the processes has failed.

Halt system mode In this mode an invalid process may cause the whole system to halt, and is useful for the development of programs, particularly when debugging concurrent systems. In this mode the primitive process STOP will also cause the whole system to halt.

Undefined mode In this mode, an invalid process may have an arbitrary effect, and is only useful for optimising programs known to be correct!

DRAFT --- March 31, 1992

J Syntax summary

J.1

Collected syntax

 

 

 

 

J.1.1

Assignment

 

 

 

 

 

assignment

 

variable.list := expression.list

 

 

 

 

 

 

expression.list

|

name ( 0 , expression )

 

 

1 , expression

 

 

|

( value.process

 

 

 

)

 

 

 

variable.list

 

1 , variable

 

 

 

 

 

J.1.2

Replicator

 

 

 

 

 

replicator

 

name = base FOR count

 

 

 

 

 

 

base

 

expression

 

 

 

 

 

 

 

count

 

expression

 

 

 

 

 

 

J.1.3

Process constructions

 

 

 

 

sequence

 

SEQ

 

 

 

 

 

process

 

 

 

 

 

 

|

SEQ replicator

 

 

 

process

 

 

conditional

 

IF

 

 

 

 

 

choice

 

 

 

 

 

 

|

IF replicator

 

 

 

 

choice

 

 

choice

|

guarded.choice

 

 

conditional

 

 

 

|

specification

 

 

 

 

choice

 

 

guarded.choice

 

boolean

 

 

 

process

 

 

 

 

 

DRAFT --- March 31, 1992

selection

selector

option

case.expression

loop

parallel

alternation

alternative

guarded.alternative

variant

CASE selector

 

option

 

 

 

expression

 

1 , case.expression

 

process

 

| ELSE process

| specification option

expression

WHILE boolean

 

 

 

process

 

PAR

 

 

process

 

 

 

| PAR replicator process

 

ALT

 

 

 

alternative

 

|

ALT replicator

 

alternative

 

|

guarded.alternative

alternation

 

|

channel ? CASE

 

 

variant

 

|

boolean & channel ? CASE

 

 

variant

 

|

specification

 

 

alternative

 

 

guard

 

process

 

 

 

 

specification

 

variant

 

 

 

|

tagged.list

 

 

process

 

|

specification

 

 

variant

 

DRAFT --- March 31, 1992

guard

discrimination

discriminant

process

specification

J.1.4 Data types

data.type

|

input

boolean & input

|

boolean & SKIP

|

ACCEPT call.channel ( , call.formal

 

process

|

boolean & ACCEPT call.channel ( ,

 

process

|

GRANT channel

 

process

|

boolean & GRANT channel

 

process

 

CASETAG expression

discriminant

 

 

name

process

 

|

SKIP

STOP

|

specification

 

process

|

declaration

abbreviation

|

definition

|

EXPORT

 

export.item

 

FROM

 

specification

 

:

|

BOOL

BYTE

|

INT

|

INT16

|

INT32

|

INT64

|

REAL32

|

REAL64

|

NONE

|

[ expression ] data.type

|

name

)

call.formal )

DRAFT --- March 31, 1992

definition

structured.type

field.name

specifier

J.1.5 Values

abbreviation

J.1.6 Variables

variable

declaration

abbreviation

J.1.7 Channels

channel.type

|

DATA TYPE name IS data.type :

DATA TYPE name

 

structured.type

 

:

 

RECORD

data.type 1, field.name :

 

|

UNION

 

data.type 1, name :

name

|

data.type

[]specifier

|

[ expression ]specifier

VAL name IS expression :

| VAL specifier name IS expression :

|

variable[name]

[ variable FROM base FOR count ]

|

[ variable FOR count ]

|

[ variable FROM base ]

|

variable[expression]

|

data.type 1 , name :

INITIAL data.type name IS expression :

 

name IS variable :

| specifier name IS variable :

|

RESULT name IS variable :

|

RESULT specifier name IS variable :

|

CHAN OF protocol

name

|

[expression]channel.type

DRAFT --- March 31, 1992

channel

declaration

abbreviation

input

input.item

tagged.list

variant

output

output.item

|

name

channel[expression]

|

[channel FROM base FOR count]

|

[channel FROM base ]

|

[channel FOR count]

|

[ 1, channel ]

|

[CHAN replicator : channel]

|

module[name]

 

channel.type 1, name :

 

|

name IS channel :

specifier name IS channel :

|

channel ? 1 ; input.item

channel ? CASE tagged.list

|

channel ? CASE

 

variant

|

variable

variable :: variable

|

tag

tag ; 1 ; input.item

 

specification

variant

 

|

tagged.list

 

process

|

specification

 

variant

|

channel ! 1 ; output.item

channel ! tag

|

channel ! tag ; 1 ; output.item

|

port ! expression

|

expression

expression :: expression

DRAFT --- March 31, 1992

definition

 

CHAN TYPE name

 

RECORD

 

 

 

 

 

declaration

 

 

:

 

 

|

CHAN TYPE name

 

 

RECORD

 

 

 

declaration

 

 

:

 

 

|

PROTOCOL name

 

 

CASE

 

 

 

tagged.protocol

 

 

:

 

 

|

PROTOCOL name IS simple.protocol :

 

|

PROTOCOL name IS sequential.protocol :

protocol

|

name

 

 

simple.protocol

simple.protocol

|

data.type

 

data.type::[]data.type

sequential.protocol

 

1 ; simple.protocol

 

 

 

tagged.protocol

|

tag

 

 

tag ; sequential.protocol

tag

specifier

J.1.8 Call channels

call.channel

name

|

channel.type

[]specifier

|

[expression]specifier

|

name

call.channel[expression]

|

[ 1, call.channel ]

|

[CALL replicator : call.channel ]

|

[ call.channel FROM base FOR count ]

|

[ call.channel FROM base ]

|

[ call.channel FOR count ]

|

module[name]

DRAFT --- March 31, 1992

declaration

abbreviation

call.actual

call.formal

call.type

specifier

J.1.9 Sharing

declaration

shared.call

shared.channels

J.1.10 Timers

timer

declaration

 

call.type name ( , call.formal ) :

 

|

name IS call.channel :

specifier call.header IS call.channel :

|

expression

variable

|

data.type 1 , name

VAL data.type 1 , name

|

INITIAL data.type 1 , name

|

RESULT data.type 1 , name

|

CALL

[expression]call.type

|

call.type

[]specifier

|

[expression]specifier

shared.call name ( 0, formal ) : | shared.channels name :

|

SHARED CALL

[expression]shared.call

|

SHARED name

[expression]shared.channels

name

|

timer[expression]

|

[timer FROM base FOR count]

|

[timer FROM base]

|

[timer FOR count]

 

timer.type 1, name :

 

DRAFT --- March 31, 1992

abbreviation

timer.type

timer.input

delayed.input

specifier

J.1.11 Expressions

boolean byte

expression

operand

valof

|

name IS timer :

specifier name IS timer :

|

[expression]timer.type

TIMER

timer ? variable

timer ? AFTER expression

|

timer.type

[]specifier

|

[expression]specifier

expression

character

|

operand

monadic.operator operand

|

operand dyadic.operator operand

|

MOSTPOS data.type

|

MOSTNEG data.type

|

expression[name]

|

conversion

|

WIDTHOF (data.type)

|

variable

literal

|

table

|

(expression)

|

( value.process

 

)

|

name ( 0 , expression )

specification valof

DRAFT --- March 31, 1992

literal

table

conversion

digit

exponent

hex.digit

integer

real

decoration

J.1.12 Procedures

definition

|

integer

 

byte

 

|

integer(decoration)

 

|

byte(decoration)

 

|

real(decoration)

 

|

string

 

|

TRUE | FALSE

 

|

[](NONE)

 

|

[ 1 , expression

]

|

[ , expression

](decoration)

|

[VAL replicator : expression]

|

( name :- expression ) (decoration)

|

table [ subscript ]

 

[ 1 , expression

]

|

[ table FROM subscript FOR count ]

|

[ table FROM subscript ]

|

[ table FOR count ]

 

|

data.type operand

 

data.type ROUND operand

|

data.type TRUNC operand

0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

+digits | -digits

digit | A | B | C | D | E | F

digits | #hex.digits

digits.digits | digits.digits Eexponent

data.type

PROC name ( 0 , formal )

 

process

 

:

 

DRAFT --- March 31, 1992