eliminating GOTOs

P.G.Hamer@bnr.co.uk (Peter Hamer)
Thu, 27 May 1993 10:54:50 GMT

          From comp.compilers

Related articles
eliminating GOTOs P.G.Hamer@bnr.co.uk (1993-05-27)
Re: eliminating GOTOs nandu@cs.clemson.edu (1993-05-27)
Re: eliminating GOTOs preston@dawn.cs.rice.edu (1993-05-27)
Re: eliminating GOTOs whalley@fork.cs.fsu.edu (1993-05-28)
Re: eliminating GOTOs oz@ursa.sis.yorku.ca (1993-05-28)
Re: eliminating GOTOs furukawa@is.s.u-tokyo.ac.jp (1993-05-28)
Re: eliminating GOTOs mitchell@mdd.comm.mot.com (1993-05-29)
[1 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: P.G.Hamer@bnr.co.uk (Peter Hamer)
Keywords: theory, design, question
Organization: BNR Europe Ltd, London Road, Harlow, England.
Date: Thu, 27 May 1993 10:54:50 GMT

Can anybody point me at algorithms for removing GOTOs from programs?

Sounds a bit silly, but it has come up when converting some algorithms
from an intermediate format into a proprietary language with "structured
constructs" and "exit" but no GOTO.

Obviously Djikstra's algorithm serves as an existence proof; loop round
one big case statement indexed by a variable representing the program
location counter.

Identifying simple "structured" situations is obviously easy. More
difficult cases where code may need to be duplicated (or moved into
procedures) probably aren't too difficult *in isolation*. But I would
really like to find an algorithm that would handle the general case (ie
spaghetti code).

Regards, Peter

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.