Next: , Previous: PRS Attributes, Up: PRS


15.3 Loops

Loop syntax, unrolling, etc...

Loops can appear in expressions and in rules in the PRS language. A rule-loop can be written as:

The loop-var is declared with a identifier, and may be referenced in the body rules. The rule-loop is repeatedly expanded using the values spanned by the range. (The range may be written implicitly or explicitly.) If the range evaluates empty, then the body is skipped during unrolling. Rule-loops may be nested, i.e., they may contain other loops. The current limit for the size of an expression is 65535 sub-expressions.

An expression-loop is written as:

The loop-var and range have the same meanings as when used in rule-loops. op may be & or |. The body expression is repeatedly expanded with the op operator. Expression-loops may be nested, i.e., they may contain other expression-loops. If the range evaluates empty, ... We need to specify these semantics!

Interpret the following: