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.

106 van Wijngaarden, et al.'HEAD's were 'union of', the equivalence is determined by examining thecorresponding components, according to the following scheme:rule 'TAll,ETY' componentsd 'FIELDS mode" 'FIEI,I)S'e "PARAMETERS yielding MOll)" 'PARAME'I'I.:I{~" and "MOll)"f 'FIELDS FIEI,I)' 'FIEI,I)S" and "I,'IEI,I)'f 'PARAMETERS PARAMETER" 'PARAMETERS" and "PARAMETER'i 'MODE field TAG' 'MOI)E" and "TA(;"j 'MODE parameter' 'MODE"In the case of unions, the "TAILETY's are of the form 'MOOI)SI mode' and'MOODS2 mode'. Since 'MOOD's within equivalent unions may commute.as in the modes specified by union (real, int) and union (int, real), theequivalence is determined by checking that "MOOI)SI' is a subset of"MOOI)S2' and that 'MOODS2' is a subset of 'MOOI)SI', where the subsettest, of course, invokes the equivalence test recursively (rules k,l,m,n,o,p).A 'MOLD' is developed (rule c) into the form "HEAD TAII,EI"~' bydetermining that(i) it is already of that form: in which case markers ('yin' and 'yang')may be placed in its 'SAFE' for the later determination of well-formedness(see 7.4) :(if) it is some 'MU definition of MODE': in which case "MU has MOI)E' isstored in its 'SAFE' (provided that this particular "MU" is not therealready) and the "MOI)E' is developed:(iii) it is some 'MU application': in which case there must be some 'MIIhas MODE' in its 'SAFE' already. That 'MODE" is then developed after awell-formedness check (see 7.4) consisting of the determination that thereis at least one 'yin" and at least one "yang' in the 'SAFE" which is morerecent than the "MU has MODE'.}{Before a pair of 'TAILETY's is tested for equivalence, it isremembered in the 'SAFE" that the original pair of "MOII)'s is being tested.This is used to force a shortcut to "WHETHER true" if these 'MOlD'sshould ever be tested again for equivalence lower down the productiontree. Since the number of pairs of component 'MOlD's that can be derivedfrom any two given 'MOlD's is finite, it follows that the testing processterminates.It remains to be shown that the process is correct. Consider theunrestricted (possibly infinite) production tree that would be obtained ifthere were no shortcut in the syntax (by omitting the first alternativetogether with the first member of the other alternative of rule b). If two'MOlD's are not equivalent, then there exists in their mode trees ashortest path from the top node to some node exhibiting a difference.Obviously, the reflection of this shortest path in the unrestrictedproduction tree cannot contain a repeated test for the equivalence of anypair of 'MOlD's, and therefore none of the shortcuts to "WHETHER true" inALGOL <strong>68</strong> Revised Report 107the restricted production tree can occur on this shortest path.Consequently, the path to the difference must be present also in the(restricted) production tree produced by the syntax. If the testing processdoes not exhibit a difference in the restricted tree, then no difference canbe found in any number of steps; i.e., the "MOll)'s are equivalent.}7.4. Well-formedness{A mode is well formed if(i) the elaboration of an actual-declarer specifying that mode is a finiteaction (i.e., any value of that mode can be stored in a finite memory)and(if) it is not strongly coercible from itself (since this would lead toambiguities in coercion).}7.4.1. Syntaxa) WHETHER (NOTION) shields SAFE to SAFE{73c} :where (NOTION) is (PLAIN)or (NOTION) is (FLEXETY ROWS of)or (NOTION) is (union of) or (NOTION) is (void),WHETHER true.b) WHETHER (PREF) shields SAFE to yin SAFE{73e} : WHETHER true.e) WHETHER (structured with) shields SAFE to yang SAFE{73c} :WHETHER true.d) WHETHER (procedure with) shields SAFE to yin yang SAFE{73c} :WHETHER true.[As a by-product of mode equivalencing, modes are tested for. wellformedness(7.3.1.c). All nonrecursive modes are well formed. Forrecursive modes, it is necessary that each cycle in each spelling of thatmode (from 'MU definition of MODE" to "MU application') passes throughat least one "HEAD' which is yin, ensuring condition (i) and one (possiblythe same) 'HEAD" which is yang, ensuring condition (if). Yin 'HEAD's are"PREF' and 'procedure with'. Yang "HEAD's are 'structured with' and'procedure with'. The other 'HEAD's, including "FLEXETY ROWS of" and'union of', are neither yin nor yang. This means that the modes specifiedby a, b and c inmode a = struct (int n, role next), b = struct (proc b next), c = proc (c) care all well formed. However, mode d = [1 : 10] d, e = union (int, e) is nota mode-declaration.}{TaD produced the one.The one produced the two.The two produced the three.And the three produced the ten thousandthings.The ten thousand things carry the yin andembrace the yang, and through theblending of the material force they achieveharmony.Tao-te Ching, 42,Lao Tzu.}

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

Saved successfully!

Ooh no, something went wrong!