Related articles |
---|
[2 earlier articles] |
Re: c to Pascal translators? geert@sun3.iaf.nl (Geert Bosch) (1998-02-20) |
Re: c to Pascal translators? pdbaylie@eos.ncsu.edu (Peter D Baylies) (1998-02-20) |
Re: c to Pascal translators? ssu95atc@reading.ac.uk (Tony Curtis) (1998-02-20) |
Re: c to Pascal translators? derek@knosof.co.uk (1998-03-03) |
Re: c to Pascal translators? bweinra@uswest.com (Bret D Weinraub) (1998-03-05) |
Re: c to Pascal translators? bear@sonic.net (Ray Dillinger) (1998-03-06) |
Re: c to Pascal translators? fpeelo@portablesolutions.com (Frank Peelo) (1998-03-07) |
Re: c to Pascal translators? RogerHA@aol.com (RogerHA) (1998-03-08) |
Re: c to Pascal translators? joachim.durchholz@munich.netsurf.de (Joachim Durchholz) (1998-03-12) |
Re: c to Pascal translators? albaugh@agames.com (1998-03-12) |
Re: c to Pascal translators? anton@mips.complang.tuwien.ac.at (1998-03-15) |
Re: c to Pascal translators? torbenm@diku.dk (1998-03-18) |
From: | "Frank Peelo" <fpeelo@portablesolutions.com> |
Newsgroups: | comp.compilers |
Date: | 7 Mar 1998 22:38:45 -0500 |
Organization: | Indigo |
References: | 98-02-090 98-02-104 98-03-033 |
Keywords: | C, Pascal, comment |
Ray Dillinger wrote in message 98-03-033...
>Geert Bosch wrote:
>
>> That's also true the other way around. One particular tricky thing
>> in converting Pascal to C are nested procedures with proper
scoping.
>...
>But automatic translation is pretty easy, really. You just
>make lookups to identify the variables (and functions) that
>are intentionally captured and do hygienic renaming on the
>rest.
What about local variables? as in
Procedure p1;
Var
v1 : integer;
v2 : boolean;
Procedure p2;
begin
... { v1 and v2 are visible here }
end;
Begin
...
End;
presumably p2 has to be moved to outside p1 and renamed, but the
variables v1 and v2 cannot be moved out like that - what if procedure
p1 is recursive?
Do you make local variables into a struct, and pass a pointer to that
when calling p2?
FP
[You could, or you could shallow bind them and make them file-scope statics.
-John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.