
Problem Detail: Has anyone studied the problem of converting a generic flowchart to a semantically equivalent “structured flowchart” (i.e. one that only uses the ‘if’ and ‘while’ block structure)? I can see this may be relevant to code generation and optimization but I’ve not been able to find anything on the topic. Intuitively, I would say that the graph corresponding to a structured flowchart must have no intersecting cycle, if this is not the case some sort of auxiliary variable must be introduced. In the picture below, for example, the graph for the unstructured flowchart has the two cycle that intersect. In case of nested loops, one would have had one of the two cycle completely contained in the other.
I’m pretty sure that there’s much more than this. Could anyone point me in the right direction?

Asked By : Remo.D
Answered By : D.W.
Yes. This has been studied in the research literature under the name “goto removal” or “goto elimination”: it is the problem of taking a program with gotos, and removing the gotos. This became of interest after structured programming became more popular; one simplistic interpretation of structured programming was that you shouldn’t use gotos. See also the structured program theorem. If you search for “goto elimination” on Google Scholar, you will find a number of papers that discuss this topic, and from there you should be able to find many more.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/36015 Ask a Question Download Related Notes/Documents