Declarations are either global or local (to a template) and can contain declarations of clocks, bounded integers, channels (although local channels are useless), arrays, records, and types. The syntax is described by the grammar for Declarations:
Declarations ::= (VariableDecl | TypeDecl | [Function] | [ChanPriority])*
VariableDecl ::= [Type] VariableID (',' VariableID)* ';'
VariableID ::= ID [ArrayDecl]* [ '=' Initialiser ]
Initialiser ::= [Expression]
| '{' Initialiser (',' Initialiser)* '}'
TypeDecls ::= 'typedef' Type ID ArrayDecl* (',' ID ArrayDecl*)* ';'
The global declarations may also contain at most one channel priority declaration.
struct { int a; bool b; } s1 = { 2, true };an instantiation of the structure from above where the members a and b are set to 2 and true.
Currently struct can’t contain members of type double or clocks.
The typedef keyword is used to name types.
The following declares a record type S containing an integer a, a boolean b:
typedef struct
{
int a;
bool b;
} S;