Re: Translating from lagugae which allows Goto's

Joachim Durchholz <joachim.durchholz@web.de>
13 Jul 2003 23:47:43 -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)
[5 later articles]
| List of all articles for this month |
From: Joachim Durchholz <joachim.durchholz@web.de>
Newsgroups: comp.compilers
Date: 13 Jul 2003 23:47:43 -0400
Organization: Compilers Central
References: 03-07-042
Keywords: translator
Posted-Date: 13 Jul 2003 23:47:43 EDT

Dana Freer wrote:
> 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?


An automatic conversion is indeed possible, but the resulting code
will be practically unmaintainable. For example, you'll end up with
lots of duplicate code if you do a mechanical transformation, so
you'll want to either refactor that code into a separate subroutine
(if it's doing something that can be sensibly refactored in this way),
or you'll want to rearrange the code.


None of this can be done automatically. The best that can be done is a
set of tools that do the tedious and error-prone groundwork of
rearranging lines of code while the programmer restructures code to
eliminate the GOTOs.


Of course, if you don't expect any maintenance, automatic conversion
would be a viable option.


HTH
Jo


Post a followup to this message

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