Previous

3.2. Serial clauses

{The purposes of serial-clauses are

· the construction of new ranges of definitions, and

· the serial composition of actions.

A serial-clause consists of a possibly empty sequence of unlabelled phrases, the last of which, if any, is a declaration, followed by a sequence of possibly labelled units. The phrases and the units are separated by go-on-tokens, viz., semicolons. Some of the units may instead be separated by completers, viz., EXITs; after a completer, the next unit must be labelled so that it can be reached. The value of the final unit, or of a unit preceding an EXIT, determines the value of the serial-clause.

For example, the following serial-clause yields true if and only if the vector a contains the integer 8:

INT n; read(n);
[ 1: n] INT a; read(a);
FOR i TO n DO IF a [i] = 8 THEN GOTO success FI OD;
FALSE EXIT
success: TRUE 
.
}

3.2.1. Syntax

a) SOID NEST serial clause defining new PROPSETY{31a ,34f,l,35h} : SOID NEST new PROPSETY series with PROPSETY{b}. {HerePROPSETY :: DECSETY LABSETY.}

b) SOID NEST series with PROPSETY{a,b,34c } : strong void NEST unit{d}, go on{94f } token, SOID NEST series with PROPSETY{b}; where (PROPSETY) is (DECS DECSETY LABSETY), NEST declaration of DECS{41a } , go on{94f } token, SOID NEST series with DECSETY LABSETY{b}; where (PROPSETY) is (LAB LABSETY), NEST label definition of LAB{c}, SOID NEST series with LABSETY{b}; where (PROPSETY) is (LAB LABSETY) and SOID balances SOID1 and SOID2{e}, SOID1 NEST unit{d}, completion{94f } token, NEST label definition of LAB{c}, SOID2 NEST series with LABSETY{b}; where (PROPSETY) is (EMPTY), SOID NEST unit{d}.

c) NEST label definition of label TAG{b} : label NEST defining identifier with TAG{48a } , label{94f} token.

d) SOME unit{b,33b,g ,34i,35d,46m,n,521c,532e,541a,b,543c,A34Ab,c,d} : SOME UNIT{5A ,-}.

e) WHETHER SORT MOID balances SORT1 MOID1 and SORT2 MOID2{b,33b ,34d,h} : WHETHER SORT balances SORT1 and SORT2{f} and MOID balances MOID1 and MOID2{g}.

f) WHETHER SORT balances SORT1 and SORT2{e,522a } : where (SORT1) is (strong), WHETHER (SORT2) is (SORT) ; where (SORT2) is (strong), WHETHER (SORT1) is (SORT).

g) WHETHER MOID balances MOID1 and MOID2{e} : where (MOID1) is (MOID2), WHETHER (MOID) is (MOID1) ; where (MOID1) is (transient MOID2), WHETHER (MOID) is (MOID1) ; where (MOID2) is (transient MOID1), WHETHER (MOID) is (MOID2).

h) *SOID unitary clause : SOID NEST unit{d}.

i) *establishing clause : SOID NEST serial clause defining LAYER{32a } ; MODE NEST enquiry clause defining LAYER{34c } . Examples:

b)
read(x1); REAL s:=0;
sum: FOR i TO n DO (x1[i] > 0 | s +:= x1[i] | nonpos) OD EXIT
nonpos: print(s) ·
REAL s := 0;
sum: FOR i TO n DO (x1[i] > 0 | s +:= x1[i] | nonpos) OD EXIT
nonpos: print(s) ·
sum: FOR i TO n DO (x1[i] > 0 | s +:= x1[i] | nonpos) OD EXIT
nonpos: print(s) ·
FOR i TO n DO (x1[i] > 0 | s +:= x1[i] | nonpos) OD EXIT
nonpos: print(s) ·
print(s)
c)
sum:
d)
print(s)
{Often, a series must be "balanced" {3.2.1.e }. For remarks concerning balancing, see 3.4.1 .}

3.2.2. Semantics

a) The yield of a serial-clause, in an environ E, is the yield of the elaboration of its series, or of any series elaborated "in its place" {5.4.4.2 }, in the environ "established" {b}around E according to that serial-clause; it is required that the yield be not newer in scope than E.

b) The environ E "established"

is determined as follows:

· if E1 is not specified, then let E1 be E2;

· E is newer in scope than E1 and is composed of E2 and a new locale corresponding to 'PROPSETY', if C is present, and to 'EMPTY' otherwise;

Case A: C is an establishing-clause:
For each constituent mode-definition M, if any, of C,
For each constituent label-definition L, if any, of C,
If each 'PROP' enveloped by 'PROPSETY' is some 'DYADIC TAD' or 'label TAG',
then E is said to be "nonlocal" {see 5.2.3.2.b } ;

Case B: C is a declarative, a for-part or a specification:
For i = 1... n, where n is the number of 'DEC's enveloped by 'PROPSETY',


· Vi is ascribed {4.8.2.a } in E to the i-th constituent defining-identifier, if any, of C and, otherwise {in the case of an invisible for-part} , to an integral-defining-indicator-with-letter-aleph;

If C is a for-part or a specification,
then E is nonlocal.
{Other cases, i.e., when C is absent:

· E is local (see 5.2.3.2.b ), but not further defined. }

c) The yield W of a series C is determined as follows:

If C contains a direct descendent unit which is not followed by a go-on-token,
then


· W is the yield of that unit;

otherwise,


· the declaration or the unit, if any, of C is elaborated;

· W is the yield of the series of C.

{See also 5.4.4.2.Case A .}
 
Next