178/van Wijngaarden, et al.ALGOL <strong>68</strong> Revised Report 179then• the event routine corresponding to on value error is called;• if this returns false, Y is output using put and undefined is called;otherwise, the string is "edited" (jj) using Q;• the insertion of P is performed.ii) A value is input to a name N, using a picture P, as follows:If the pattern Q of P is a "choice" or "general' pattern,then a value is input to N using P (see 10.3.4.8.1.bb,ee, 10.3.4.10.1.bb);otherwise,• P is staticized;• a string controlled by Q is "indited" (kk);If the mode of N is "input compatible" with Q (see the appropriatesection),then• the string is converted to an appropriate value suitable for Nusing Q (see the appropriate section);• if the conversion is successful, the value is assigned to N;If the mode is not input-compatible, or if the conversion isunsuccessful,then• the event routine corresponding to on value error is called;• if this returns false, undefined is called;• the insertion of P is performed.jj) A string is "edited", using a pattern P, as follows:In each part of the string controlled by a sign mould,• if the first character of the string {which indicates the sign) is %"and the sign mould contains a ..... frame, then that character isreplaced by ".";• the first character (i.e., the sign) is shifted to the right across allleading zeroes in this part of the string and these zeroes are replacedby spaces (for example, using the sign mould 4z+, the string "+0003"becomes "...+3") ;In each part of the string controlled by an integral mould,• zeroes controlled by "z" frames are replaced by spaces as follows:• between the start of the string and the first nonzero digit;• between each "d", "e" or "i" frame and the next nonzero digit;(for example, using the pattern zdzd2d, the string "1801<strong>68</strong>" becomes"18.fl<strong>68</strong>"; )For each frame F of P,• the insertion of F is performed;• if F is not suppressed, the characters controlled by F are written;(for example, the string "+0003.5", when edited using the pattern 4z+ s. ","d, causes the string "._._._+3,5" to be written and the string "1801<strong>68</strong>", usingthe pattern zd .... 'zd"-19"2d, gives rise to "18-.1-19<strong>68</strong>").kk) A string is "indited", using a pattern P, as follows:For each frame F of e,• the insertion of F is performed:For each element of the string controlled by F, a character is obtainedas follows:If F is contained in a sign mould,then• if a sign has been found, a digit is expected, with "0" assuggestion:• otherwise, either a "+" or a ..... is expected, with "+" assuggestion, and, in addition, if the sign mould contains a .....frame, then a space preceding the first digit will be accepted asthe sign (and replaced by "+"):otherwise, if F is contained in an integral mould,thenIf F is suppressed,then "0" is supplied;otherwise,Case A: F is a "d" frame:• a digit is expected, with "0" as suggestion:Case B: F is a "z" frame:• a digit or space is expected, with "0" as suggestion, buta space is only acceptable as follows:• between the start of the string and the first nonzerodigit;• between each "d", "e" or "i" frame and the nextnonzero digit;• such spaces are replaced by zeroes:otherwise, if F is an "a" frame,then if F is not suppressed, a character is read and supplied:otherwise "." is supplied:otherwise, if F is not suppressed,then if F is a "." Ce", "i", "b") frame, a "." ("1o" or "\" or "e", "1"or "i", flip or flop) is expected, with "." ("1o", "1", flop) assuggestion:otherwise, if F is a suppressed "." Ce", "i") frame, the character "."("1o", "1") is supplied.ll) A member of a set of characters S is "expected", with thecharacter C as suggestion, as follows:• a character is read:If that character is one of the expected characters (i.e., a member of S),then that character is supplied:otherwise, the event routine corresponding to on char err~r is called, withC as suggestion; if this returns true and G, as possibly replaced, is oneof the expected characters, then that character is supplied: otherwise.undefined is called.}
180 van Wijngaarden, et al.10.3.4.1.2. Semantics{A format is brought into being by means of a format-text. A format isbest regarded as a tree, with a collection at each node and a picture ateach tip. In order to avoid violation of the scope restrictions, each node ofthis tree is, in this Report, packed into a value of mode "PIECE'. A formatis composed of a row of such pieces and the pieces contain pointers toeach other in the form of indices selecting from that row. An implementerwill doubtless store the tree in a more efficient manner. This is possiblebecause the field.selector of a format is hidden from the user in order thathe may not break it open.Although a format-text may contain ENCLOSED-clauses (in replicatorsand format-patterns) or units (in general-patterns), these are notelaborated at this stage but are, rather, turned into routines forsubsequent calling as and when they are encountered during formattedtransput. Indeed, the elaboration of a format-text does not result in anyactions of any significance to the user.}a) The yield of a format-text F, in an environ E, is a structured valuewhose only field is a multiple value W, whose mode is "row of PIECE',composed of a descriptor ((1, n)) and n elements determined as follows:• a counter i is set to 1;• F is "transformed" {b} in E into W, using i.b) A format-text or a collection-list-pack C is "transformed" in anenviron E into a multiple value W whose mode is "row of PIECE', using acounter i, as follows:• the element of W selected by (i) is a structured value, whose mode is'PIECE' and whose fields, taken in order, are• {cp} undefined;• {count} undefined;• {bp} undefined;• {c} a multiple value V, whose mode is "row of COLLECTION', havinga descriptor ((1, m)), where m is the number of constituent collectionsof C, and elements determined as follows:For j = 1 ..... m, letting C. be the j-th constituent collection of C,ICase A: The direct descendents of C. include a picture P:J• the constituent pattern T, if any, and the insertion I of P areelaborated collaterally;• the j-th element of V is a structured value, whose mode is'PICTURE' and whose fields, taken in order, are• [p} the yield of T, if any, {e, 10.3.4.8.2, 10.3.4.9.2, 10.3.4.10.2}and, otherwise, empty;• (i} the yield of ! {d};/ALGOL <strong>68</strong> Revised Report 181Case B: The direct descendents of C. include a first insertion I1, aJreplicator REP, a collection-list-pack P and a second insertion 12:• i is increased by 1;• I1, REP and 12 are elaborated collaterally;• the j-th element of Y is a structured value whose mode is'COLLITEM' and whose fields, taken in order, are• {il} the yield of I1 {d};• {rep} the yield of REP {c};• (Pli;• (i2] the yield of 12;• P is transformed in E into W, using i.c) The yield, in an environ E, of a NEST-UNSUPPRESSETY-replicatorR {10.3.4.1.l.g,h} is a routine whose mode is 'procedure yielding integral',composed of a proeedure-yielding-integrai-NEST-routine-text whose unit isU, together with the environ necessary {7.2.2.c} for U in E, where U isdetermined as follows:Case A: R contains a meek-integral-ENCLOSED-clause G:• O is a new unit akin {1.1.3.2.k} to C;Case B: R contains a fixed-point-numeral D, but no ENCLOSED-clause:• U is a new unit akin to D;Case C: R is invisible:• U is a new unit akin to a fixed.point-numeral which has an intrinsicvalue {8.1.1.2} of 1.d) The yield of an insertion I {10.3.4.1.1.d} is a multiple value Wwhose mode is 'INSERTION', determined as follows:* let U 1 ..... U n be the constituent UNSUPPRESSETY-replieators of I,and let A i, i = 1 ..... n, be the denoter-coercee or alignment-code{immediately} following U.;• let R 1, .... R and O 1 ... D be the {collateral} yields of U 1, On ' ' n .... nand A 1 ..... A n, where the yield of an alignment-code is the {characterwhich is the} intrinsic value {8.1.4.2.b} of its LETTER-symbol;• the descriptor of W is ((1, n)):• the element of W selected by (i), i = 1 ..... n, is a structured value {ofthe mode specified by struct .(proc lnt rep, union (string, char) sa)} whosefields, taken in order, are• {rep} R.;I• {sa} D..Ie) The yield of an integral-, real-, boolean-, complex-, string: or bitspatternP {10.3.4.2.1.a, 10.3.4.3.1.a ..... t0.3.4.7.l.a} is a structured value Wwhose mode is 'PATTERN', determined as follows:
- Page 2 and 3:
van Wijngaarden, et al.1.1.4.2. Par
- Page 4:
Acknowledgements{Habent sua fata li
- Page 8 and 9:
14 van Wijngaarden, et al.0.3.4. Mo
- Page 10 and 11:
. . . . . . . 4 " ' 0 . . . . . . .
- Page 12 and 13:
22 van Wijngaarden, et al.• let P
- Page 14 and 15:
26 van Wijngaarden, et al.{Since so
- Page 16 and 17:
30 van Wijngaarden, et aLloperandfo
- Page 18 and 19:
34 van Wijngaarden, et al.j) WHETHE
- Page 20 and 21:
38 van Wijngaarden, et al.A protono
- Page 22 and 23:
42 van Wijngaarden, et al.d) If N i
- Page 24 and 25:
46 van Wijngaarden, et al.c) {There
- Page 26 and 27:
50 van Wijngaarden, et al.c) The ph
- Page 28 and 29:
54 van Wijngaarden, et al.3.1.1. Sy
- Page 30 and 31:
58 van Wijngaarden, et al.where (RO
- Page 32 and 33:
62 van Wijngaarden, et al.1) SOlD N
- Page 34 and 35:
66 van Wijngaarden, et al.ALGOL 68
- Page 36 and 37:
70 van Wijngaarden, et el.For each
- Page 38 and 39:
74 van Wijngaarden, et al.If 'MODE"
- Page 40 and 41: 78 J van Wijngaarden, et al.C) SECO
- Page 42 and 43: 82 van Wijngaarden, et al.ALGOL 68
- Page 44 and 45: 86 van Wijngaarden. et al.ALGOL 68
- Page 46 and 47: 90 van Wijngaarden, et al.5.4.4.1.
- Page 48 and 49: 94van Wijngaarden, et al.ALGOL 68 R
- Page 50 and 51: 98 van Wijngaarden, et al.Assignati
- Page 52 and 53: 102 van Wijngaarden, et at.{A nest,
- Page 54 and 55: 106 van Wijngaarden, et al.'HEAD's
- Page 56 and 57: 110 van Wijngaarden, et al.ALGOL 68
- Page 58 and 59: 114van Wijngaarden, et al.ALGOL 68
- Page 60 and 61: 118 van Wijngaarden, et al.ALGOL 68
- Page 62 and 63: 122 van Wijngaarden, et al.style ii
- Page 64 and 65: 126 van Wijngaarden, et al.b) The c
- Page 66 and 67: 130van Wijngaarden, et al.ALGOL 68
- Page 68 and 69: 134van Wijngaarden, et al.ALGOL 68
- Page 70 and 71: 138d)e)f)g)h)i)J)k)1)m)n)van Wijnga
- Page 72 and 73: 142 van Wijngaarden, et al.physics
- Page 74 and 75: 146 van Wijngaarden, et al.gg) On s
- Page 76 and 77: 150van Wijngaarden, et al.ALGOL 68
- Page 78 and 79: 154/van Wijngaarden, et al.ALGOL 68
- Page 80 and 81: 158 van Wijngaarden, et el.fi;ref p
- Page 82 and 83: 162van Wijngaarden, et al.ALGOL 68
- Page 84 and 85: 166van Wijngaarden, et al.ALGOL 68
- Page 86 and 87: 170/van Wijngaarden, etal.ALGOL 68
- Page 88 and 89: 174J)K)L)M)N)O)P)a)b)c)d)e)van Wijn
- Page 92 and 93: 182 van Wijngaarden, et al.• let
- Page 94 and 95: 186van Wijngaarden, et al./ALGOL 68
- Page 96 and 97: 190 van Wijngaarden, etal.composed
- Page 98 and 99: 194h)i)J)van Wijngaa(rden, et al.pr
- Page 100 and 101: 198 van Wijngaarden, et al.¢ strin
- Page 102 and 103: 202tvan Wijngaarden, et al.ALGOL 68
- Page 104 and 105: 206 van Wijngaa~den. et al.10.3.6.1
- Page 106 and 107: 210 van Wijngaarden, et al.!ALGOL 6
- Page 108 and 109: 214 van Wijngaarden, et al.inoperat
- Page 110 and 111: 218fvan Wijngaarden, et al.¢ move
- Page 112 and 113: 222 van Wijngaarden, etaL{overflow}
- Page 114 and 115: 226 van Wijngaarden, et al.ALGOL 68
- Page 116 and 117: 230max int 10.2.1.cmax real 10.2.l.
- Page 118 and 119: 234 van Wijngaarden, et al.ALGOL 68