General Information
Tutorials
Reference Manuals
Libraries
Translation Tasks
Tools
Administration
|
LIDO - Reference ManualIterationsThe general principle of computations in trees guarantees that the computations specified for each tree node context are executed exactly once. The iteration construct allows to specify cyclic dependencies that may cause certain computations to be iterated until a specified condition holds.
SyntaxComputation ::= Iteration Terminator | Attribute '=' Iteration Terminator Iteration ::= 'UNTIL' Expression 'ITERATE' Attribute '=' Expression Example: ATTR cnt, incr: int; RULE: R ::= X COMPUTE X.cnt = 1; R.done = UNTIL GT (X.cnt, 10) ITERATE X.cnt = X.incr; END; RULE: X ::= SomeThing COMPUTE X.incr = ORDER (printf ("%d\n", X.cnt), ADD (X.cnt, 1)); END;
The execution of an iteration establishes the postcondition specified by
the
The attribute defined in the
The
Restrictions
The There must be an initializing non-cyclic definition for the iteration attribute. The cyclic dependencies involved in the iteration may not include computations of upper contexts of the iteration context. Some computations that do not lie on the iteration cycle may also be reexecuted on iteration if not specified otherwise. This effect can be avoided by specifying the initial iteration attribute computation to depend on them, or by specifying them to depend on the postcondition of the iteration.
There may be several iterations for the same iteration attribute. The so
specified iterations may be arbitrary merged if not otherwise specified.
In any case the
Termination of iterations has to be ensured by suitable The iteration attribute may not be a chain attribute.
|