86 van Wijngaarden. et al.ALGOL <strong>68</strong> Revised Report87referred to by the yield is shown:[0: 9,2: 11] mti3;i3 [1, 3:10 @3] ¢((3, 10))¢;i3 [1, 3: 10] ¢((1, 8))¢;i3 [1,3: ] ¢((1,9))¢;i3 [1,: ] ¢((1,10))¢;i3 [1, ] ¢((2,11))¢;i3[,2] ¢((0,9))¢.}f)g)where (DECS2) is (DECS3 DECS4),formal MODE NEST2 declarer{46b},NEST2 MODE parameter joined definition of DECS3{41h,c},and also{94f} token, NEST2 declarative defining new DECS4{e}.NEST2 MODE parameter definition of MODE TAG2{41c} :MODE NEST2 defining identifier with TAG2{48a}.* formal MODE parameter :NEST MODE parameter definition of MODE TAG{f}.5.4. Units associated with routines{Routines are created from routine-texts (5.4.1) or from jumps (5.4.4),and they may be "called" by calls (5.4.3), formulas (5.4.2) or bydeproceduring {6.3).}5.4.1. Routine texts{A routine-text always has a formal-declarer, specifying the mode ofthe result, and a routine-token, viz., a colon. To the right of this colonstands a unit, which prescribes the computations to be performed whenthe routine is called. If there are parameters, then to the left of the formaldeclarerstands a declarative containing the various formal-parametersrequired.Examples:void : print (x);(ref real a, real b) bool : (a < b [ a := b; true ] false).}5.4.1.1. Syntaxa) procedure yielding MOlD NESTI routine text{44d,5A} :formal MOlD NESTI declarer{46b}, routine{94f} token,strong MOlD NESTI unit{32d}.b) procedure with PARAMETERS yieldingMOlD NESTI routine text{44d,SA} :NESTI new DECS2 declarative definingnew DECS2{e} brief pack,where DECS2 like PARAMETERS{c,d,-},formal MOlD NESTI declarer{46b}, routine{94f} token,strong MOlD NESTI new DECS2 unit{32d}.c) WHETHER DECS DEC like PARAMETERS PARAMETER{b,c} :WHETHER DECS like PARAMETERS{c,d,-}and DEC like PARAMETER{d,-}.{PARAMETER :: MODE parameter.}d) WHETHER MODE TAG like MODE parameter{b,c} :WHETHER true.e) NEST2 declarative defining new DECS2{b,e,34j} :formal MODE NEST2 deelarer{46b},NEST2 MODE parameter joined definition of DECS2{41b,c} ;{Examples:a) real : random × 10e) bool a, b • bool a, bool b5.4.1.2. Semanticsb) (heel a, b) bool : (a [ b I false)f) a}The yield of a routine-text T, in an environ E, is the routine composedof(i) T, and(ii) the environ necessary for {7.2.2.c} T in E.5.4.2. Formulas{Formulas are either dyadic or monadic: e.g., x + i or abs x. The orderof elaboration of a formula is determined by the priority of its operators;monadic formulas are elaborated first and then the dyadic ones from thehighest to the lowest priority.}5.4.2.1. SyntaxA) DYADIC :: priority PRIO.B) MONADIC :: priority iii iii iii i.C) ADIC :: DYADIC ; MONADIC.D) TALLETY :: TALLY ; EMPTY.a) MOlD NEST DYADIC formula{c,SB} :MODEl NEST DYADIC TALLETY operand{c,-},procedure with MODEl parameter MODE2 parameteryielding MOlD NEST applied operator with TAD{48b},where DYADIC TAD identified in NEST{72a},MODE2 NEST DYADIC TALLY operand{c,-}.b) MOlD NEST MONADIC formula{c,5B} :procedure with MODE parameter yielding MOlDNEST applied operator with TAM {48b},MODE NEST MONADIC operand{c}.c) MODE NEST ADIC operand{a,b} :firm MODE NEST ADIC formula{a,b} eoercee{61b} ;where (ADIC) is (MONADIC), firm MODE NEST SECONDARY{5C}.
88van Wijngaarden, et al.ALGOL <strong>68</strong> Revised Report 89d)e)f)g){Examples:* MOlD formula : MOlD NEST ADIC formula{a,b}."DUO dyadic operator with TAD :DUO NEST DEFIED operator with TAD{48a,b}."MONO monadic operator with TAM :MONO NEST DEFIED operator with TAM[48a,b}.* MODE operand : MODE NEST ADIC operand{c}.a) -x + 1c) -x • 1 }5.4.2.2. Semanticsb) -xThe yield W of a formula F, in an environ E, is determined as follows:• let R be the routine yielded in E by the operator of F;• let Y 1 ..... V n in is 1 or 2} be the [collateral] yields of the operands of F,in an environ E1 established {locally, see 3.2.2.b} around E;• W is the yield of the calling {5.4.3.2.b} of R in El, with Y 1 ..... Yn;• it is required that W be not newer in scope than E.{Observe that a;b is not precisely the same as a b in the usualnotation; indeed, the value of (-1 ;2 +4 =5) and that of (4- 1 12=3) bothare true, since the first minus-symbol is a monadic-operator, whereas thesecond is a dyadic-operator.}5.4.3. Calls{Calls are used to command the elaboration of routines parametrizedwith actual-parameters.Examples:sin (x) • (P l sin l cos) (x).}5.4.3.1. Syntaxa) MOlD NEST cail{5D} : meek procedure with PARAMETERS yieldingMOlD NEST PRIMARY{5D},actual NEST PARAMETERS{b,c} brief pack.b) actual NEST PARAMETERS PARAMETER{a,b} :actual NEST PARAMETERS{b,c}, and also{94f} token,actual NEST PARAMETER{c}.c) actual NEST MODE parameter{a,b} : strong MODE NEST unit{32d}.{Examples:a) put(standout, x) (see 10.3.3.1.a)b) standout, x c) x }5.4.3.2. Semanticsa) The yield W of a call C, in an environ E, is determined as follows:• let R Ca routine} and Y 1 ..... V n be the {collateral} yields of thePRIMARY of C, in E, and of the constituent actual-parameters of C, in anenviron E1 established {locally, see 3.2.2.b} around E;• W is the yield of the calling {b} of R in E1 with Y 1 ..... Vn;• it is required that W be not newer in scope than E.b) The yield W of the "calling" of a routine R in an environ El,possibly with {parameter} values V 1 ..... Vn' is determined as follows:• let E2 be the environ established {3.2.2.b} upon El, around the environ ofR, according to the declarative of the declarative.pack, if any, of theroutine-text of R, with the values V 1 ..... V n, if any;• W is the yield in E2 of the unit of the routine-text of R.{Consider the following serial-clause:proc samelson = (int n, proc (inO real f) real :begin long real s : = long O;for i ton do s + : = leng f (i) t 2 od;shorten long sqrt (s)end;same~son (m, (intj) real : xl [j]).In that context, the last call has the same effect as the following cast:real (int n = m, proc (int) real f= (int j) real : xl [j];begin long real s : = long O;for i ton do s + : = leng f (i) T 2 od;shorten long sqrt (s)end).The transmission of actual-parameters is thus similar to theelaboration of identity-declarations (4.4.2.a); see also establishment(3.2.2.b) and ascription (4.8.2.a).}5.4.4. Jumps{A jump may terminate the elaboration of a series and cause someother labelled series to be elaborated in its place.Examples:y : = if x >_ 0 then sqrt (x) else goto princeton fl •goto st pierre de chartreuse.Alternatively, if the context expects the mode 'procedure yieldingMOLD', then a routine whose unit is that jump is yielded instead, as inproc vokl m := goto north berwick.}
- 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 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