Declarations

Declarations are either global or local (to a process) and can contain declarations of clocks, bounded integers, constants, channels (although local channels are useless), and types. The syntax is described by the grammar for Declarations:

Declarations  ::= (VariableDecl | TypeDecl | Function)*
VariableDecl  ::= Type VariableID (',' VariableID)* ';'
VariableID    ::= ID ArrayDecl* [ '=' Initialiser ]
Initialiser   ::= Expression
               |  '{' Initialiser (',' Initialiser)* '}'
TypeDecls     ::= 'typedef' Type ID ArrayDecl* (',' ID ArrayDecl*)* ';'

where Type and ArrayDecl are further described in the section on types, Expression in the section on expressions, and Function in the section on functions.

Examples

Type Declarations

The typedef keyword is used to name types.

Example

The following declares a record type S containing an integer a, a boolean b and a clock c:

typedef struct 
{ 
  int a;   
  bool b;
  clock c;
} S;