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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

102 van Wijngaarden, et at.{A nest, except the primal one (which is just 'new'), is some 'NESTLAYER' (i.e., some 'NEST new PROPSETY'). A 'PROP' is identified byfirst looking for it in that 'LAYER' (rule a). If the 'PROP' is some "labelTAX' or 'DYADIC TAX', then a simple match of the 'PROP's is a sufficienttest (rule e). If the "PROP" is some 'MOLD TALLETY TAX', then the modeequivaleneing mechanism must be invoked (rule c). If it is not found inthe 'LAYER', then the search continues with the "NEST' (without that'LAYER'), provided that it is independent of all 'PROP's in that 'LAYER';otherwise the search is abandoned (rule a). Note that rules b and c dodouble duty in that they are also used to check the validity of applied-fieldselectors(4.8.1.d) .}7.2.2. Semanticsa) If some NEST-range R {3.0.I.f} contains an applied-indicator I{4.8.1.b} of which there is a descendent where-PROP-identified-in-NEST-LAYER, but no descendent where-PROP-identified-in-NEST, then R is the"defining range" of that I. {Note that "NEST' is always the nest in forcejust outside the range.}b) A QUALITY-applied-indicator-with-TAX I whose defining NESTrange{a} is R "identifies" the QUALITY-NEST-LAYER-defining-indicatorwith-TAXcontained in R.{For example, in(¢1¢ real i = 2.0; (¢2¢ int i = 1; (¢3¢ real x; print (i) ¢3¢) ¢2¢) ¢1¢)there are three ranges. The applied-identifier i in print (i) is forced, by thesyntax, to be an integral-NEST-new-real-letter-i-new-integral-letter-i-newreferenee-to-real-letter-x-applied-identifier-with-letter-i(4.8.1.b). Itsdefining range is the NEST-new-real-letter-i-serial-clause-defining-newintegral-letter-i(3.2.1.a) numbered ¢2¢, it identifies the defining-identifier icontained in int i (not the one in real i), and its mode is 'integral'.}{By a similar mechanism, a DYADiC-formula (5.4.2.1.a) may be said to"identify" that DYADiC-defining-operator (4.8.1.a) which determines itspriority.}c) The environ E "necessary for" a construct C in an environ E1 isdetermined as follows:If E1 is the primal environ {2.2.2.a},then E is El;otherwise, letting E1 be composed of a locale L corresponding to some'PROPSETY" and another environ E2,If C contains any QUALiTY-applied-indicator-with-TAX• which does not identify {b} a defining.indicator contained in C,• which is not a mode-indication directly descended from a formalorvirtual-declarer, and• which is such that the predicate 'where QUALITY TAX resides inPROPSETY' {7.2.1.b} holds,then E is El:ALGOL <strong>68</strong> Revised Report 103otherwise, {L is not necessary for C and} E is the environ necessary forC in E2.{The environ necessary for a construct is used in the semantics ofroutine-texts (5.4.1.2) and in "establishing" (3.2.2.b). For example, in¢2¢ proc void pp; int n; (¢I¢ proc p = void : print (n); pp := p)if E1 and E2 are the environs established by the elaboration of the serialclausesmarked by the comments ¢I¢ and ¢2¢, then E2 is the environnecessary in E1 for the routine.text void: print (n), and so the routineyielded by p in E1 is composed of that routine-text together with E2(5.4.1.2). Therefore, the scope of that routine is the scope of E2 (2.1.3.5.c)and hence the assignment (5.2.1.2.b) invoked by pp := p is well defined.}7.3. Equivalence of modes{The equivalence or nonequivalence of 'MOlD's is determined in thissection. For a discussion of equivalent 'MOlD's see 2.1.1.2.}{One way of viewing recursive modes is to consider them as infinitetrees. Such a "mode tree" is obtained by repeatedly substituting in somespelling, for each 'MU application', the 'MODE' of the corresponding 'MUdefinition of MODE'. Thus, the spelling 'mui definition of structured withintegral field letter i reference to mui application field letter n mode'would give rise to the following mode tree:'structured with"I I J'integral" 'field" 'letter i'"structured with"I [ I"integral' 'field" "letter i'II'reference to"I'reference to"II''mode'I I"field" "letter n'II'field" "letter n'I(et cetera).''mode'Two spellings are equivalent if and only if they give rise to identical modetrees. The equivalence syntax tests the equivalence of two spellings by, asit were, simultaneously developing the two trees until a difference is found(resulting in a blind alley) or until it becomes apparent that no differencecan be found. The growing production tree reflects to some extent thestructure of the mode trees.}7.3.1. SyntaxA) SAFE :: safe ; MU has MODE SAFE ; yin SAFE ; yang SAFE ;remember MOIDI MOLD2 SAFE.

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

Saved successfully!

Ooh no, something went wrong!