PART V Environment and Examples

10. Standard environment

{The "standard environment" encompasses the constituent EXTERNAL-preludes, system-tasks and particular-postludes of a program-text.}

10.1. Program texts

{The programmer is concerned with particular-programs {10.1.1.g}. These are always included in a program-text {10.1.1.a}which also contains the standard-prelude, a library-prelude, which depends upon the implementation, a system-prelude and system-tasks, which correspond to the operating environment, possibly some other particular-programs, one or more particular-preludes (one for each particular-program) and one or more particular-postludes.}

10.1.1. Syntax

A) EXTERNAL :: standard ; library ; system ; particular.

B) STOP :: label letter s letter t letter o letter p.

a) program text : STYLE begin{94f} token, new LAYER1 preludes{b}, parallel{94f} token, new LAYER1 tasks{d} PACK, STYLE end{94f} token.

b) NEST1 preludeså : NEST1 standard prelude with DECS1{c}, NEST1 library prelude with DECSETY2{c}, NEST1 system prelude with DECSETY3{c}, where (NEST1) is (new EMPTY new DECS1 DECSETY2 DECSETY3).

c) NEST1 EXTERNAL prelude with DECSETY{b,f} : strong void NEST1 series with DECSETY1 {32b}, go on{94f} token where (DECSETY1) is (EMPTY), EMPTY.

d) NEST1 taskså : NEST1 system task{e} list, and also{94f} token, NEST1 user task{f} PACK list.

e) NEST1 system task{d} : strong void NEST1 unit{32d}.

f) NEST1 user task{d} : NEST2 particular prelude with DECS{c}, NEST2 particular program{g} PACK, go on{94f} token, NEST2 particular prelude{i}, where (NEST2) is (NEST1 new DECS STOP).

g) NEST2 particular program{f} : NEST2 new LABSETY3 joined label definition of LABSETY3{h}, strong void NEST2 new LABSETY3 ENCLOSED clause{31a,33a,c,34a,35a}.

h) NEST joined label definition of LABSETY{g,h} : where (LABSETY) is (EMPTY), EMPTY where (LABSETY) is (LAB1 LABSETY1), NEST label definition of LAB1{32c}, NEST joined label definition of LABSETY1{h}.

i) NEST2 particular postlude{f} : strong void NEST2 series with STOP{32b}. {Examples:

}

a)
( #! standard-prelude #SKIP; #! library-prelude #SKIP; #! system-prelude #SKIP; PAR BEGIN #! system-task-1 #SKIP, #! system-task-2 #SKIP, ( #! particular-prelude #SKIP; (start: commence: BEGIN SKIP END); #! particular-postlude #SKIP), ( #! another user-task #SKIP) END
b)
#! standard-prelude {10.2, 10.3}#SKIP; #! library-prelude #SKIP; #! system-prelude {10.4.1}#SKIP;
d)
#! system-task-1 {10.4.2.a}#SKIP, #! system-task-2 #SKIP, ( #! particular-prelude #SKIP; (start: commence: BEGIN SKIP END); #! particular-postlude #SKIP), ( #! another user-task #SKIP)
f)
#! particular-prelude {10.5.1}#SKIP ; (start: commence: BEGIN SKIP END); #! particular-postlude {10.5.2}#SKIP
g)
start: commence: BEGIN SKIP END
h)
start: commence:
i)
stop: lock(stand in); lock(stand out); lock(stand back)

10.1.2. The environment condition

a) A program in the strict language must be akin {1.1.3.2.k}to some program-text whose constituent EXTERNAL-preludes and particular-postludes are as specified in the remainder of this section. {It is convenient to speak of the standard-prelude, the library-prelude, the particular-programs, etc. of a program when discussing those parts of that program which correspond to the constituent standard-prelude, etc. of the corresponding program-text.}

b) The constituent standard-prelude of all program-texts is that standard-prelude whose representation is obtained {10.1.3}from the forms given in sections 10.2 and 10.3.

c) The constituent library-prelude of a program-text is not specified in this Report {but must be specified for each implementation; the syntax of 'program text' ensures that a declaration contained in a library-prelude may not contradict any declaration contained in the standard-prelude} .

d) The constituent system-prelude (system-task-list) of all program-texts is that system-prelude (system-task-list) whose representation is obtained from the forms given in section 10.4, with the possible addition of other forms not specified in this Report {but to be specified to suit the operating environment of each implementation} .

e) Each constituent particular-prelude (particular-postlude) of all program-texts is that particular-prelude (particular-postlude) whose representation is obtained from the forms given in section 10.5, with the possible addition of other forms not specified in this Report {but to be specified for each implementation} .

10.1.3. The method of description of the standard environment

A representation of an EXTERNAL-prelude, system-task or particular-postlude is obtained by altering each form in the relevant sections of this chapter in the following steps: 

Step 1: If a given form F begins with OP {the operator-symbol} followed by one of the marks #P#, #Q#, #R# or #E#, then F is replaced by a number of new forms each of which is a copy of F in which that mark {following the OP} is (all other occurrences in F of that mark are) replaced, in each respective new form, by: 
Case A: The mark is #P#:


· -, +, #[#*, *#]# or / (-, +, * or /);

Case B: The mark is #Q#:


· #[# MINUSAB, -:= #]# , #[# PLUSAB, +:= #]#, #[# TIMESAB, *:=, *:= #]# or #[# DIVAB, /:= #]# (-:= , +:= , *:= or /:= );

Case C: The mark is #R#:


· #[# <, LT #]# , #[# <=, LE #]# , #[# =, EQ #]#, #[# , NE #]# , #[# >=, GE #]# or #[# >, GT #]# (<, <=, , /=, >= or >);

Case D: The mark is #E#:


· #[# =,EQ #]# or #[# /=, NE #]# ( or /=);

Step 2: If, in some form, as possibly made in the step above, #a# occurs followed by an INDICATOR (a field-selector) I, then that occurrence of #a# is deleted and each INDICATOR (field-selector) akin {1.1.3.2.k}to I contained in any form is replaced by a copy of one same INDICATOR (field-selector) which does not occur elsewhere in the program and Step 2 is taken again;


Step 3: If a given form F, as possibly modified or made in the steps above, begins with OP {the operator-symbol} followed by a chain of TAO-symbols separated by and-also-symbols, the chain being enclosed between á and ñ, then F is replaced by a number of different "versions" of that form each of which is a copy of F in which that chain, together with its enclosing á and ñ, has been replaced by one of those TAO-symbols {; however, an implementation is not obliged to provide more than one such version {9.4.b}} ;


Step 4: If, in a given form, as possibly modified or made in the steps above, there occurs a sequence S of symbols enclosed between á and ñ and if, in that S, #L# INT, #L# REAL, #L# COMPL, #L# BITS or #L# BYTES occurs, then S is replaced by a chain of a sufficient number of sequences separated by and-also-symbols, the n-th of which is a copy of S in which copy each occurrence of #l# (#L#, #K#, #S#) is replaced by (n - 1) times long (LONG, LENG, SHORTEN), followed by an and-also-symbol and a further chain of a sufficient number of sequences separated by and-also-symbols, the m-th of which is a copy of S in which copy each occurrence of #l# (#L#, #K#, #S#) has been replaced by m times short (SHORT, SHORTEN, LENG); the á and ñ enclosing that S are then deleted;


Step 5: If, in a given form F, as possibly modified or made in the steps above, #L# INT, (#L# REAL, #L# COMPL, #L# BITS, #L# BYTES) occurs, then F is replaced by a sequence of a sufficient number of new forms, the n-th of which is a copy of F in which copy each occurrence of #l# (#L#, #K#, #S#) is replaced by (n - 1) times long (LONG, LENG, SHORTEN), and each occurrence of long #l# (LONG #L#) by n times long (LONG), followed by a further sequence of a sufficient number of new forms, the m-th of which is a copy of F in which copy each occurrence of #l# (#L#, #K#, #S#) is replaced by m times short (SHORT, SHORTEN, LENG), and each occurrence of long #l# (LONG #L#) by (m - 1) times short (SHORT);


Step 6: Each occurrence of #F#fff (PRIM) in any form, as possibly modified or made in the steps, above, is replaced by a representation of a letter-aleph-symbol (primal-symbol) {9.4.a};


Step 7: If a sequence of representations beginning with and ending with C occurs in any form, as possibly modified or made in the steps above, then this sequence, which is termed a "pseudo-comment", is replaced by a representation of a declarer or closed-clause suggested by the sequence;


Step 8: If, in any form, as possibly modified or made in the steps above, a routine-text occurs whose calling involves the manipulation of real numbers, then this routine-text may be replaced by any other routine-text whose calling has approximately the same effect {; the degree of approximation is left undefined in this Report (see also 2.1.3.1.e)} ;


Step 9: In the case of an EXTERNAL-prelude, a form consisting of a skip-symbol followed by a go-on-symbol (SKIP;) is added at the end. {The term "sufficient number", as used in Steps 4 and 5 above, implies that no intended particular-program should have a different meaning or fail to be produced by the syntax solely on account of an insufficiency of that number.}


Wherever {in the transput declarations} the representation 10 ('134, ^) occurs within a character-denotation or string-denotation, it is to be interpreted as the representation of the string-item {8.1.4.1.b}used to indicate "times ten to the power" (an alternative form {, if any,} of "times ten to the power", "plus i times") on external media. {Clearly, these representations have been chosen because of their similarity to those of the times-ten-to-the-power-symbol {9.4.1.b}and the plus-i-times-symbol {9.4.1.c}, but, on media on which these characters are not available, other string-items must be chosen (and the letter-e-symbol and the letter-i-symbol are obvious candidates).}

{The declarations in this chapter are intended to describe their effect clearly. The effect may very well be obtained by a more efficient method.}