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.

64 van Wijngaarden, et al.value of the control-integer is required. A while-part while true may beomitted. For example,for i from 1 by 1 to n while true do print ("a") odmay be writtento n do print ("a") od.ALGOL <strong>68</strong> Revised Reportd) from-5e) while i < n do task1 od • do task1; task2 odf) while i < n do task1; task2 odg) while i < n h) do task1; task2 od }65The hierarchy of ranges is illustrated by:3.5.1. SyntaxA)_for J-- 7 from2 whileI 3 doFROBYT :: from ; by ; to.a) strong void NESTI loop clause{5D,551a} :NESTI STYLE for part defining new integral TAG2{b},NESTI STYLE intervals{c},NESTI STYLE repeating part with integral TAG2{e}.b) NESTI STYLE for part defining new integral TAG2{a} :STYLE for{94g,-} token,integral NESTI new integral TAG2 defining identifierwith TAG2{48a} ;where (TAG2) is (letter aleph), EMPTY.e) NESTI STYLE intervals{a} : NESTI STYLE from part{d} option,NESTI STYLE by part{d} option,NESTI STYLE to part{d} option.d) NESTI STYLE FROBYT part{c} :STYLE FROBYT{94g,-} token, meek integral NESTI unit{32d}.e) NESTI STYLE repeating part with DEC2{a} :NESTI new DEC2 STYLE while do part{f} ;NESTI new DEC2 STYLE do part{h}.f) NEST2 STYLE while do part{e} :NEST2 STYLE while part defining LAYER3{g},NEST2 LAYER3 STYLE do part{h}.g) NEST2 STYLE while part defining LAYER3{f} :STYLE while{94g,-} token,boolean NEST2 enquiry clause defining LAYER3{34c,-}.h) NEST3 STYLE do part{e,f} :STYLE do{94g,-} token,strong void NEST3 serial clause defining LAYER4{32a},STYLE od{94g,-} token.{Examples:a) fori whilei < n dotaskl od • ton dotaskl; task2odh) for i c) from-5 to +5byto3.5.2. SemanticsA loop-clause C, in an environ El, is elaborated in the following Steps:Step 1: All the constituent FROBYT-parts, if any, of C are elaboratedcollaterally in El;• let f be the yield of the constituent from-part, if any, of C, and be 1otherwise;• let b be the yield of the constituent by-part, if any, of C, and be 1otherwise;• let t be the yield of the constituent to-part, if any, of C, and beabsent otherwise;• let E2 be the environ established {nonlocally (3.2.2.b)} around El,according to the for-part-defining-new-integral-TAG2 of C, and with theinteger f;Step 2: Let i be the integer accessed [2.1.2.c} by 'integral TAG2" inside thelocale of E2;If t is not absent,thenIf b> 0andi >torifb < 0andi < t,then C in E1 {is completed and} yields empty;{otherwise, Step 3 is taken; }Step 3: Let an environ E3 and a truth value w be determined as follows:Case A: C does not contain a constituent while-part:• E3 is E2;• w is true;Case B: C contains a constituent while-part P:• E3 is established {perhaps nonloeally (3.2.2.b)} around E2according to the enquiry-clause of P;• w is the yield in E3 of that enquiry-clause;Step 4: If w is true,then• the constituent do-part of C is elaborated in E3;• 'integral TAG2" is made to access i + b inside the locale of E2;• Step 2 is taken again;otherwise,• C in E1 {is completed and} yields empty.{The loop-clausefor i from ul by u2 to u3 while condition do action odis thus equivalent to the following void-closed.clause:

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

Saved successfully!

Ooh no, something went wrong!