[NEXT] [PREV]
HANDBOOK
/ LANGUAGE REFERENCE MANUAL
/Members 

Gentle
Applications Concepts Examples Handbook Support Download

Member =
Ident ["(" [Expression{ "," Expression}]
[">" [Pattern{ "," Pattern}]] ")"]
 ContextDesignator "<" Expression  ContextDesignator ">" Pattern  IdentUC "::" Ident  String  "(" {Member} "" {Member} {"" {Member}} ")"  "[" {Member} "]" . ContextDesignator = [IdentUC "'"] Ident . The body of a rule is given by a sequence of members. A member is elaborated as follows.
Predicate InvocationsA 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.
Context UpdatesA 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.
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.
Context QueriesA member of the form
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.
It is a checked runtime error to access an undefined context designator.
Key DefinitionsA member of the form
The variable V is defined as a unique key of type T.
Anonymous TokensA member of the form
Alternative StatementsA 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.
Conditional StatementsA member of the form
