From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Delphi & Ada; Ada to C++
Date: 1998/02/21
Date: 1998-02-21T00:00:00+00:00 [thread overview]
Message-ID: <dewar.888076592@merv> (raw)
In-Reply-To: 6cmrti$8j4$1@news.nyu.edu
In article <01bd3e24$280e1c00$a8fc82c1@xhv46.dial.pipex.com> "Nick Roberts" <Ni
k.Roberts@dial.pipex.com> writes:
>Now to throw the cat among the pigeons: how difficult would it be to
>retro-compile the tree into C (or even C++)?
(tree here = GNAT tree)
It would conceivably be possible to compile it into VERY low level C, where
you had a few variables corresponding to registers, say called r0, r1, r2
and you generated C that for example, in unoptimized mode, might
compile
A := B + C;
where A,B,C are all local variables, into something like
r0 = *(fp+100);
r1 = *(fp+104);
r2 = r0 + r1;
*(fp+108) = r2;
This is *really* using C as a low level assembler :-)
The way you could do this is to write a config file for gcc that treated
C in this way as a kind of pseudo-machine. We once thought about this as
a way to make a version of GNAT that could be ported in native mode, rather
than requiring cross-compilers, but it was never more than a passing
interesting idea.
You could try to reverse compile the tree at a much higher level into
C, but this would be a huge task, comparable to that of writing a
compiler, and in some ways much more difficult (it would be like trying
to do a complete house renovation, rather than building a new house --
as those who have gone through it know, the renovation can often be the
harder task).
Furthermore, some of the constructs would still generate rubbish, since
C just does not have the required semantic richness.
(e.g. what do you do with overflow checking, and what do you do with
nested procedures ....)
next prev parent reply other threads:[~1998-02-21 0:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-02-13 0:00 Ada to C++ Translators David Kusuda
1998-02-14 0:00 ` Larry Kilgallen
1998-02-16 0:00 ` David Weller
1998-02-18 0:00 ` Jean D. Ichbiah
1998-02-18 0:00 ` David Weller
1998-02-18 0:00 ` Brian Rogoff
1998-02-21 0:00 ` Esa Pulkkinen
1998-02-23 0:00 ` Brian Rogoff
1998-02-19 0:00 ` Jean D. Ichbiah
1998-02-19 0:00 ` Larry Kilgallen
1998-02-25 0:00 ` Scott Leschke
1998-02-25 0:00 ` David Weller
1998-02-19 0:00 ` Delphi & Ada; Ada to C++ Nick Roberts
1998-02-19 0:00 ` David Weller
1998-02-19 0:00 ` Nick Roberts
1998-02-19 0:00 ` Jon S Anthony
1998-02-20 0:00 ` Nick Roberts
1998-02-21 0:00 ` Richard Kenner
1998-02-21 0:00 ` Robert Dewar [this message]
1998-02-21 0:00 ` Simon Wright
1998-02-21 0:00 ` Richard Kenner
1998-03-05 0:00 ` Robert I. Eachus
-- strict thread matches above, loose matches on Subject: below --
1998-02-23 0:00 Marin David Condic, 561.796.8997, M/S 731-96
1998-02-24 0:00 ` Dale Stanbrough
1998-02-24 0:00 ` Robert Dewar
1998-02-25 0:00 ` Jean-Pierre Rosen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox