From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,30352abc52760363 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Delphi & Ada; Ada to C++ Date: 1998/02/21 Message-ID: #1/1 X-Deja-AN: 327286022 References: <01bd3d7c$2406b3e0$LocalHost@xhv46.dial.pipex.com> <01bd3e24$280e1c00$a8fc82c1@xhv46.dial.pipex.com> <6cmrti$8j4$1@news.nyu.edu> X-Complaints-To: usenet@news.nyu.edu X-Trace: news.nyu.edu 888077004 9053 (None) 128.122.140.58 Organization: New York University Newsgroups: comp.lang.ada Date: 1998-02-21T00:00:00+00:00 List-Id: In article <01bd3e24$280e1c00$a8fc82c1@xhv46.dial.pipex.com> "Nick Roberts" 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 ....)