HANDBOOK
/ LANGUAGE REFERENCE MANUAL
/
The body of a rule is given by a sequence of members. A member is elaborated as follows.
A member of the form
p must be a predicate with n input parameters and m output parameters. Let T_{1}, ..., T_{n} be the input types and S_{1}, ..., S_{m} the output types. The expressions E_{1}, ..., E_{n} appear on positions with types T_{1}, ..., T_{n}, and the patterns P_{1}, ..., P_{m} appear on positions with types S_{1}, ..., S_{m}.
The expressions E_{1}, ..., E_{n} are evaluated, yielding values Tau_{1}, ..., Tau_{n}. p is invoked with these input values. If the invocation fails, the member M fails. If it succeeds, it yields output values Sigma_{1}, ..., Sigma_{m}. These values are matched against the patterns P_{1}, ..., P_{m}. If the matching fails, the member M fails. Otherwise, the member succeeds and the variables appearing in P_{1}, ..., P_{m} are defined.
A member of the form
The value of D is defined as the value of the expression E. If T is the type of D, E appears on a position with type T.
The context designator D may be of the form C, where C must be declared as a context variable. The type of the designator is the type of the context variable.
Example
NestingLevel < NThis sets the value of the context variable NestingLevel to the value of the local variable N. 

A context designator may also have the form I ' F ; I must be a variable of the key type of a context table T. Entries of T must have a field F. The type of the designator is the type of the F.
Example
Let Lab be a local variable that refers to a table entry with a field Coordinate. Then Lab'Coordinate < Locsets this field to the value of Loc. 

The value of the context designator D is matched against the pattern P. If this succeeds, the member succeeds and the variables appearing in P are defined. Otherwise, the member fails.
Examples
NestingLevel > NThis defines the local variable N according to the current value of the context variable NestingLevel. Let Lab be a local variable that refers to a table entry with a field Coordinate. Then Lab'Coordinate > Locdefines the local variable Loc according to the value of this field. 

It is a checked runtime error to access an undefined context designator.
The variable V is defined as a unique key of type T.
Example
Lab :: LabelThe value of the local variable Lab is the unique key of a newly created entry of table Label. 

A member of the form
A member of the form
The alternatives A_{1}, ..., A_{n} are evaluated from left to right until one alternative A_{i} succeeds. Then M succeeds. If all alternatives fail, M fails.
An alternative A_{i} has the form M_{i,1}, ..., M_{i,ni}. These members are evaluated from left to right until one member fails. Then the alternative fails. If all members succeed, the alternative succeeds.
A variable that is defined in all alternatives A_{1}, ..., A_{n} is defined by the alternative statement and may be used outside it. Such a variable must be defined with the same type in all alternatives.
A variable that is defined in one but not all alternatives is local to that alternative.