Eli   Documents

General Information

 o Eli: Translator Construction Made Easy
 o Global Index
 o Frequently Asked Questions
 o Typical Eli Usage Errors

Tutorials

 o Quick Reference Card
 o Guide For new Eli Users
 o Release Notes of Eli
 o Tutorial on Name Analysis
 o Tutorial on Scope Graphs
 o Tutorial on Type Analysis
 o Typical Eli Usage Errors

Reference Manuals

 o User Interface
 o Eli products and parameters
 o LIDO Reference Manual
 o Typical Eli Usage Errors

Libraries

 o Eli library routines
 o Specification Module Library

Translation Tasks

 o Lexical analysis specification
 o Syntactic Analysis Manual
 o Computation in Trees

Tools

 o LIGA Control Language
 o Debugging Information for LIDO
 o Graphical ORder TOol

 o FunnelWeb User's Manual

 o Pattern-based Text Generator
 o Property Definition Language
 o Operator Identification Language
 o Tree Grammar Specification Language
 o Command Line Processing
 o COLA Options Reference Manual

 o Generating Unparsing Code

 o Monitoring a Processor's Execution

Administration

 o System Administration Guide

Mail Home

LIDO - Reference Manual

Previous Chapter Next Chapter Table of Contents


Iterations

The 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.

Syntax

    Computation ::= 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 UNTIL expression.

The attribute defined in the ITERATE-clause is the iteration attribute. The expression of that definition usually depends cyclically on the iteration attribute itself. There has to be another non cyclically dependent computation for the iteration attribute, which is executed initially before the iteration. The iteration attribute may be a VOID attribute. All computations that depend on the iteration attribute are executed at least once.

The ITERATE computation and all computations that depend on it are reexecuted if the UNTIL condition does not hold.

Restrictions

The UNTIL condition must yield an int value being used as a conditional value.

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 UNTIL conditions hold after completion of the iterations.

Termination of iterations has to be ensured by suitable UNTIL conditions and computations.

The iteration attribute may not be a chain attribute.


Previous Chapter Next Chapter Table of Contents