|[3 earlier articles]|
|Re: Source to source compiling firstname.lastname@example.org (1994-09-13)|
|Re: Source to source compiling email@example.com (1994-09-13)|
|Re: source to source compiling firstname.lastname@example.org (1994-09-18)|
|Re: Source to source compiling email@example.com (Robert Bernecky) (1994-09-18)|
|Re: Source to source compiling firstname.lastname@example.org (1994-09-18)|
|Re: Source to source compiling email@example.com (1994-09-16)|
|Re: Source to source compiling firstname.lastname@example.org (1994-09-19)|
|Re: Source to source compiling email@example.com (1994-09-22)|
|Re: Source to source compiling firstname.lastname@example.org (1994-09-22)|
|From:||email@example.com (Raul Garcia Garcia)|
|Date:||Mon, 19 Sep 1994 10:33:50 GMT|
Casper Gripenberg <firstname.lastname@example.org> wrote:
> 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.
Robert Bernecky (email@example.com) said:
> Another well-written, clear article is:
> Taming Control Flow: A Structured Approach to Eliminating GOTO
> Ana M. Erosa and Laurie J. Hendren
> ACAPS Technical Memo 76
> McGill University
> ... the method is both efficient and effective.
Certainly. I used this method in my engineer's degree required project,
a C to occam2 translator.
Since occam2 lacks of goto statement, I had to map all C flow-control
constructions into occam2 IF and WHILE statements. This article (and
others, also at McGill and related to their McCAT compiler project)
allowed an implementation of a powerful, yet straightforward, algorithm
which made the desired translation. The algorithm operates function by
function, and consists of two phases:
1. All C control-flow constructs (do, while, for, if, switch, break,
continue, return and goto) are converted to the most general one -- goto.
2. The entire function code, whose flow of control is expressed now only
using goto statemets, is normalized into the desired control-flow
paradigm -- in this case the occam2 one (IF and WHILE statements only).
The method purposed in the article allows the design of a second phase
which map the code into other control-flow paradigms distinct of the
Check wally.cs.mcgill.ca [188.8.131.52] for more details. There are
some technical memos (in /pub/doc/memos) and even a thesis (Maryam
Emami Master's thesis, in /pub/doc/thesis/emami) related to the
McCAT compiler, last time I checked (about 3 months ago).
Raul Garcia Garcia
Phone: +34 1 337 4341
Return to the
Search the comp.compilers archives again.