Re: source to source compiling

ghiya@vani.cs.mcgill.ca (Rakesh GHIYA)
Sun, 18 Sep 1994 03:50:41 GMT

          From comp.compilers

Related articles
Source to source compiling casper@snakemail.hut.fi (Casper Gripenberg) (1994-09-11)
Re: Source to source compiling eanders+@CMU.EDU (Eric A. Anderson) (1994-09-12)
Re: Source to source compiling norman@flaubert.bellcore.com (1994-09-14)
Re: Source to source compiling mabp@bga.com (1994-09-13)
Re: Source to source compiling f1rederc@iia.org (1994-09-13)
Re: source to source compiling ghiya@vani.cs.mcgill.ca (1994-09-18)
Re: Source to source compiling bernecky@eecg.toronto.edu (Robert Bernecky) (1994-09-18)
Re: Source to source compiling toconnor@vcd.hp.com (1994-09-18)
Re: Source to source compiling pjj@cs.man.ac.uk (1994-09-16)
Re: Source to source compiling rgg@tidos.tid.es (1994-09-19)
Re: Source to source compiling lexa@adam.botik.yaroslavl.su (1994-09-22)
Re: Source to source compiling md@pact.srf.ac.uk (1994-09-22)
| List of all articles for this month |
Newsgroups: comp.compilers
From: ghiya@vani.cs.mcgill.ca (Rakesh GHIYA)
Keywords: translator
Organization: Compilers Central
References: 94-09-031
Date: Sun, 18 Sep 1994 03:50:41 GMT

Casper Gripenberg <casper@snakemail.hut.fi> writes:


>Now the problem is that I don't know how to convert these conditional goto
>statements in the source language to while/if-then-else constructs in the
>destination language. How do I check for eg. loops, and presumably some of
>the goto statements just cannot be translated into if-them-else statements.


You might want to look at:




@InProceedings{ErosaHen94,
      Author = "Ana M. Erosa and Laurie J. Hendren",
      Title = "Taming Control Flow: A Structured Approach to Eliminating Goto
                        Statements",
      Booktitle = "Proceedings of {IEEE 1994} International Conference on
      Computer Languages",
      month = May,
      Year = 1994
}


ftp from => wally.cs.mcgill.ca:pub/doc/memos/memo76.ps.gz




This method to eliminate gotos is simple to understand and straightforward
to implement on an AST representation of the program. It has been
successfully implemented in our McCAT C compiler, and is able to eliminate
all kinds of commonly used gotos (not interprocedural jumps). I remember
one of the test program implemented a finite state machine with the same
pattern of gotos like you mention. The resulting program was structured,
though it ran a bit slower than the original, due to extra conditionals
introduced. The paper contains more empirical results on the performance
penalties incurred. Most of the times they are negligible.




Rakesh.


School of Computer Science
McGill University
Montreal, Canada.


ghiya@acaps.cs.mcgill.ca
--


Post a followup to this message

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