Re: Translating from lagugae which allows Goto's

Martin Ward <Martin.Ward@durham.ac.uk>
21 Jul 2003 00:31:20 -0400

          From comp.compilers

Related articles
[5 earlier articles]
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)
Re: Translating from lagugae which allows Goto's vbdis@aol.com (2003-07-17)
Re: Translating from lagugae which allows Goto's Martin.Ward@durham.ac.uk (Martin Ward) (2003-07-21)
Re: Translating from lagugae which allows Goto's strohm@airmail.net (John R. Strohm) (2003-07-21)
Re: Translating from language which allows Goto's channahr@comcast.net (norm@plumpirate.com) (2003-07-25)
| List of all articles for this month |
From: Martin Ward <Martin.Ward@durham.ac.uk>
Newsgroups: comp.compilers
Date: 21 Jul 2003 00:31:20 -0400
Organization: Compilers Central
References: 03-07-042
Keywords: translator, tools
Posted-Date: 21 Jul 2003 00:31:20 EDT

On Friday 04 Jul 2003 5:03 am, 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?


It is always possible to remove GOTOs by adding a flag variable (which
records which statement is to be executed next) and turning the whole
program into a giant finite state machine. But I imagine that what
you want is nice structured code, but with the GOTOs removed!


The FermaT transformation system includes transformations for
simplifying and removing "action systems". Any GOTO program can be
translated to an action system. The transformation
Simplify_Action_System will reduce a system to a single action (if
there are no irreducible loops) without duplicating
code. Collapse_Action_System can also handle irreducible loops by
duplicating code: it automatically creates procedures in order to
reduce the amount of duplication. The worst case is probably still an
exponential growth: but it has been tested on many millions of lines
of assembler code without encountering that problem.


FermaT is available under the GPL from:
http://www.cse.dmu.ac.uk/~mward/fermat.html
http://www.dur.ac.uk/martin.ward/fermat.html


--
Martin


Martin.Ward@durham.ac.uk http://www.cse.dmu.ac.uk/~mward/ Erdos number: 4


Post a followup to this message

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