|[2 earlier articles]|
|Re: Source to source compiling email@example.com (1994-09-14)|
|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 (Pete Jinks)|
|Organization:||Dept of Computer Science, University of Manchester, U.K.|
|Date:||Fri, 16 Sep 1994 15:14:40 GMT|
Casper Gripenberg <firstname.lastname@example.org> wrote:
>The source language is a kind of state langage. All
>states have the same kind of structure, ie. in the beginning you initilaze
>variables, then comes some code to execute and at last a bunch of
>conditional jumps to other states.
>The destination langage is very c-like. With while loops and if-then-else
>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.
Bo:hm & Jacopini did something similar to show any arbitrary flowchart can
be expressed without gotos:
if (a) state=3; else
if (b) state=2; else
You can use state=0 to cause the code to terminate.
You could replace the switch by more nested if-then-elses if your
destination language hasn't got that construct.
I am not sure why you want to check for loops - in general this is akin to
the halting problem isn't it?
Return to the
Search the comp.compilers archives again.