Structured program theorem: Difference between revisions

Content deleted Content added
m References: now the list is even more alphabetical
Line 17:
This version of the theorem replaces all the original program's control flow with a single global <code>while</code> loop that simulates a [[program counter]] going over all possible labels (flowchart boxes) in the original non-structured program. Harel traced the origin of this folk theorem to two papers marking the beginning of computing. One is the 1946 description of the [[von Neumann architecture]], which explains how a [[program counter]] operates in terms of a while loop. Harel notes that the single loop used by the folk version of the structured programming theorem basically just provides [[operational semantics]] for the execution of a flowchart on a von Neumann computer.{{sfn|Harel|1980|p=383}} Another, even older source that Harel traced the folk version of the theorem is [[Stephen Kleene]]'s [[Kleene's T predicate|normal form theorem]] from 1936.{{sfn|Harel|1980|p=383}}
 
[[Donald Knuth]] criticized this form of the proof, which results in [[pseudocode]] like the one below, by pointing out that the structure of the original program is completely lost in this transformation.{{sfn|Knuth|1974|p=274}} Similarly, Bruce Ian Mills wrote about this approach that "The spirit of block structure is a style, not a language. By simulating a Vonvon Neumann machine, we can produce the behavior of any spaghetti code within the confines of a block-structured language. This does not prevent it from being spaghetti."{{sfn|Mills|2005|p=279}}
 
<syntaxhighlight lang="pascal">