Premium
The robust implementation of sequence‐controlled iteration
Author(s) -
Newey M. C.,
Waite W. M.
Publication year - 1985
Publication title -
software: practice and experience
Language(s) - English
Resource type - Journals
SCImago Journal Rank - 0.437
H-Index - 70
eISSN - 1097-024X
pISSN - 0038-0644
DOI - 10.1002/spe.4380150704
Subject(s) - computer science , pascal (unit) , correctness , sequence (biology) , construct (python library) , programming language , compiler , theoretical computer science , algorithm , biology , genetics
Many Pascal compilers generate incorrect code for statements. The trap that catches many implementors, whereby overflow is generated incorrectly, is explained and means for avoiding it are discussed (with attention to cost). Most common languages have a similar construct in which iteration is ‘controlled’ by a sequence of values in that a variable takes on successive values of the sequence for the several executions of the ‘body’. Often, the size step is not restricted to plus‐or‐minus one (as in Pascal) and the correctness situation cannot be characterized in such black and white terms. Typically, there is a range of behaviours that are valid and the compiler writer is able to choose a compromise between time‐space overheads and avoidance of unnecessary overflow indications; we describe the latter behaviour as robust. We present techniques for implementation appropriate to several languages and direct comments at language designers warning against both ignoring and overestimating the cost of robustly implementing iteration statements with arbitrary step size. Lastly, we criticize the design of instructions available in some machines, ostensibly to support the implementation of such sequence controlled iteration statements.