Previous

4.4. Identifier declarations

{Identifier-declarations provide MODE-defining-identifiers, by means of either identity-definitions or variable-definitions.

Examples:

REAL pi = 3.1416 ·REAL scan =0.05 . The latter example, which is a variable-declaration, may be considered as an equivalent form of the identity-declaration

REF REAL scan = LOC REAL := 0.05 . The elaboration of identifier-declarations causes values to be ascribed to their identifiers; in the examples given above, 3.1416 is ascribed to pi and a new local name which refers to 0.05 is ascribed to scan.}

4.4.1. Syntax

A) MODINE :: MODE ; routine.

B) LEAP :: local ; heap ; primal.

a) NEST MODINE identity declaration of DECS{41a } : formal MODINE NEST declarer{b,46b } , NEST MODINE identity joined definition of DECS{41b,c } .

b) VICTAL routine NEST declarer{a,523b } : procedure{94d } token.

c) NEST MODINE identity definition of MODE TAG{41c } : MODE NEST defining identifier with TAG{48a } , is defined as{94d } token, MODE NEST source for MODINE{d}.

d) MODE NEST source for MODINE{c,f,45c } : where (MODINE) is (MODE), MODE NEST source{521c } ; where (MODINE) is (routine), MODE NEST routine text{541a,b ,-}.

e) NEST reference to MODINE variable declaration of DECS{41a } : reference to MODINE NEST LEAP sample generator{523b } , NEST reference to MODINE variable joined definition of DECS{41b,c } .

f) NEST reference to MODINE variable definition of reference to MODE TAG{41c } : reference to MODE NEST defining identifier with TAG{48a } , becomes{94c} token, MODE NEST source for MODINE{d}; where (MODINE) is (MODE), reference to MODE NEST defining identifier with TAG{48a } .

g) *identifier declaration : NEST MODINE identity declaration of DECS{a}; NEST reference to MODINE variable declaration of DECS{e}.

{Examples:

}

a)
INT m = 4096 ·PROC r10 = REAL: random * 10
b)
PROC
c)
m = 4096
d)
4096 ·REAL: random * 10
e)
REAL x, y ·PROC pp:= REAL: random * 10
f)
pp := REAL : random * 10 ·x

4.4.2. Semantics

a) An identity-declaration D is elaborated as follows:

· the constituent sources-for-MODINE of D are elaborated collaterally;

For each constituent identity-definition D1 of D,

b) A variable-declaration D is elaborated as follows:

· the sample-generator {5.2.3.1.b } G of D and all the sources-for-MODINE, if any, of the constituent variable-definitions of D are elaborated collaterally;

For each constituent variable-definition-of-reference-to-MODE-TAG D1 of D,


· let W1 be a "variant" {c}, for 'MODE', of the value referred to by the yield N of G;

· let N1 be a newly created name equal in scope to N and referring to W1;

· if N1 is a stowed name {2.1.3.2.b }, then N1 is endowed with subnames {2.1.3.3.e , 2.1.3.4.g };

· N1 is ascribed {4.8.2.a } to the defining-identifier of D1;

· the yield of the source-for-MODINE, if any, of D1 is assigned {5.2.1.2.b } to N1.

{An actual-declarer which is common to a number of variable-definitions is elaborated only once. For example, the elaboration of

INT m := 10; [1 : m +:= 1 ] INT p, q; print(m)causes 11 to be printed, and not 12; moreover, two new local names referring to multiple values with descriptor ((1, 11)), and undefined elements, are ascribed to p and to q.}

c) A "variant" of a value V, for a mode M, is a value W acceptable to {2.1.3.6.d } M, and determined as follows:

Case A: M is some 'structured with FIELDS mode':
For each 'MODE field TAG' enveloped by 'FIELDS',

Case B: M is some 'FLEXETY ROWS of MODE1':
Other Cases:

d) The yield of an actual-routine-declarer is some routine {whose mode is of no relevance}.
 
Next