10.07.2015 Views

Algol 68 - ACM Digital Library

Algol 68 - ACM Digital Library

Algol 68 - ACM Digital Library

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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.}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!