Re: Translating from lagugae which allows Goto's

"John R. Strohm" <strohm@airmail.net>
13 Jul 2003 23:51:54 -0400

          From comp.compilers

Related articles
Translating from lagugae which allows Goto's dana.subscriptions@virgin.net (Dana Freer) (2003-07-04)
Re: Translating from lagugae which allows Goto's joachim.durchholz@web.de (Joachim Durchholz) (2003-07-13)
Re: Translating from lagugae which allows Goto's syring@email.com (Karl M Syring) (2003-07-13)
Re: Translating from lagugae which allows Goto's strohm@airmail.net (John R. Strohm) (2003-07-13)
Re: Translating from lagugae which allows Goto's bsheff2@yahoo.com (Bob Sheff) (2003-07-15)
Re: Translating from lagugae which allows Goto's postmaster@paul.washington.dc.us (Paul Robinson) (2003-07-15)
Re: Translating from lagugae which allows Goto's genew@mail.ocis.net (2003-07-15)
Re: Translating from lagugae which allows Goto's lex@cc.gatech.edu (Lex Spoon) (2003-07-17)
Re: Translating from lagugae which allows Goto's nmm1@cus.cam.ac.uk (2003-07-17)
Re: Translating from lagugae which allows Goto's joachim.durchholz@web.de (Joachim Durchholz) (2003-07-17)
[3 later articles]
| List of all articles for this month |

From: "John R. Strohm" <strohm@airmail.net>
Newsgroups: comp.compilers
Date: 13 Jul 2003 23:51:54 -0400
Organization: Compilers Central
References: 03-07-042
Keywords: translator
Posted-Date: 13 Jul 2003 23:51:54 EDT

"Dana Freer" <dana.subscriptions@virgin.net> said:
> I am not a compiler writer but have the task of writing a tranlslator to
> convert from a language which allows GOTO, GOSUB, RETURN into a language
> (like VbScript) which does not alllow GOTO etc. Is this impossible? Will
> human intervention always be required?


Human intervention is never required. During the "structured
programming" revolution of the late 1960s/early 1970s, Bohm & Jacopini
showed a mechanical procedure for the elimination of GOTO statements,
back in 1970. Their goal was to show that GOTO was not necessary in
programming languages, and they succeeded. The programs resulting
from their technique are not particularly interesting, however: their
technique essentially recasts the GOTO-spaghetti-coded program as a
giant finite state machine.


A similar technique eliminates GOSUB/RETURN, by adding an explicit
pushdown stack, i.e., converting the finite state machine into a stack
machine.


The problem is not elimination of GOTO and GOSUB/RETURN. The problem
is maintenance of the resulting GOTO/GOSUB/RETURN-eliminated code.
The converted program is likely to be considerably LESS readable than
the original.


Post a followup to this message

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