66 van Wijngaarden, et al.ALGOL <strong>68</strong> Revised Report67begin int f : = ul, int b = u2, t = u3;step2:if(b>O^ f Ov b=Othen int i = f;if conditionthen action; f+: = b; go to step2fiflend.This equivalence might not hold, of course, if the loop-clause contains localgenerators,or if some of the operators above do not identify those in thestandard environment (10).}4. Declarations, declarers and indicators{Declarations serve• to announce new indicators, e.g., identifiers,• to define their modes or priorities, and• to ascribe values to those indicators and to initialize variables.}4.1. Declarations4.1.1. SyntaxA) COMMON :: mode ; priority ; MODINE identity ;reference to MODINE variable ; MODINE operation ;PARAMETER ; MODE FIELDS.{MODINE :: MODE ; routine.}a) NEST declaration of DECS{a,32b} :NEST COMMON declaration of DECS{42a,43a,44a,e,45a,-} ;where (DECS) is (DECSI DECS2),NEST COMMON declaration of DECSl{42a,43a,44a,e,45a,-},and aiso{94f} token, NEST declaration of DECS2{a}.b) NEST COMMON joined definition of PROPS PROP{b,42a,43a,44a,e,45a,46e,541e} :NEST COMMON joined definition of PROPS{b,c},and also{94f} token,NEST COMMON joined definition of PROP{c}.c) NEST COMMON joined definition of PROP{b,42a,43a,44a,e,45a,46e,54 le} :NEST COMMON definition of PROP{42b,43b,44c,f,45c,46f,541f,-}.d) * definition of PROP : NEST COMMON definition of PROP{42b,43b,44c, f,45c,46f,541 f} ;NEST label definition of PROP{32c}.{Examples:a) mode r= ref real, s =char •prio v =2, ^ =3 •int m = 4096 •real x, y •op v = (bool a, b) bool : (a [ true I b)b) r=refraal, s=char •v =2, ^ =3 •m=4096 •x, y •v = (bool a, b) bool : (a I true I b)c) r=rafreal •v =2 •m=4096 •x •v = (bool a, b) bool : (a [ true I b) }4.1.2. SemanticsThe elaboration of a declaration consists of the collateralelaboration of its COMMON-declaration and of its declaration, if any.{Thus, all the COMMON-declarations separated by and-also-tokens areelaborated collaterally.}4.2. Mode declarations{Mode-declarations provide the defining-mode-indications, which act asabbreviations for declarers constructed from the more primitive ones, orfrom other declarers, or even from themselves.For example,mode array = [m, n] real, andmode book = struct (string text, raf book next)In the latter example, the applied-mode-indication book is not only aconvenient abbreviation, but is essential to the declaration.}4.2.1. Syntaxa) NEST mode declaration of DECS{41a} :mode{94d} token, NEST mode joined definition of DECS{41b,c}.b) NEST mode definition of MOlD TALLY TAB{41e} :where (TAB) is (bold TAG) or (NEST) is (new LAYER),MOlD TALLY NEST defining mode indication with TAB{48a},is defined as{94d} token,actual MOlD TALLY NEST declarer{e}.c) actual MOlD TALLYI NEST declarer{b} :where (TALLYI) is (i),actual MOlD NEST declarator{46c,d,g,h,o,s,-} ;where (TALLYI) is (TALLY2 i),MOlD TALLY2 NEST applied mode indication with TAB2{48b}.{Examples:a) mode r = ref real, s = charh) r = raf real e) ref real • char }{The use of "TALLY" excludes circular chains of mode-definitions suchas mode a = b, b = a.
<strong>68</strong> van Wijngaarden, et al.Defining-mode-indications-with-SIZETY-STANDARD may be declaredonly in the standard-prelude, where the nest is of the form 'new LAYER'(10.1.l.b) .}4.2.2. SemanticsThe elaboration of a mode-declaration {involves no action, yields novalue and} is completed.4.3. Priority declarations{Priority-declarations are used to specify the priority of operators.Priorities from 1 to 9 are available.Since monadic-operators have effectively only one priority-level, whichis higher than that of all dyadic-operators, monadic-operators do notrequire priority-declarations.}4.3.1. Syntaxa) NEST priority declaration of DECS{41a} :priority{94d} token, NEST priority joined definition of DECS{41b,c}.b) NEST priority definition of priority PRIO TAD{41c} :priority PRIO NEST defining operator with TAD{48a},is defined as{94d} token, DIGIT{94b} token,where DIGIT counts PRIO{c,d}.{DIGIT :: digit zero ; digit one ; digit two ; digit three ; digit four ;digit five ; digit six ; digit seven ; digit eight ; digit nine.}c) WHETHER DIGITI counts PRIO i{b,c} :WHETHER DIGIT2 counts PRIO{c,d},where (digit one digit two digit three digit fourdigit five digit six digit seven digit eight digit nine)~eontains (DIGIT2 DIGITI).d) WHETHER digit one counts i{b,c} : WHETHER true.{Examples:a) prior=2, ^=3 b) v=2}4.3.2. SemanticsThe elaboration of a priority-declaration {involves no action, yields novalue and} is completed.4.4. Identifier declarations{Identifier-declarations provide MODE-defining-identifiers, by means ofeither identity-definitions or variable-definitions.Examples:real pi = 3.1416 •real scan := 0.05.ALGOL <strong>68</strong> Revised Report 69fThe latter example, which is a variable-declaration, may be considered asan equivalent form of the identity-declarationrot real scan = Ioc real := 0.05.The elaboration of identifier-declarations causes values to be ascribedto their identifiers; in the examples given above, 3.1416 is ascribed to piand a new local name which refers to 0.05 is ascribed to scan.}4.4.1. SyntaxA) 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 joineddefinition of DECS{41b,c}.f) NEST reference to MODINE variable definitionof 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 rlO= real : random x 10b) proc c) m = 4096d) 4096 • real : random x 10e) real x, y • proc pp := real : random x 10f) pp := real: random x I0 • x }4.4.2. Semanticsa) An identity-declaration D is elaborated as follows:• the constituent sourees-for-MODINE of D are elaborated collaterally;
- 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 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 90 and 91:
178/van Wijngaarden, et al.ALGOL 68
- 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