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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9adfbb907494972e X-Google-Attributes: gid103376,public X-Google-Thread: 1014db,9adfbb907494972e X-Google-Attributes: gid1014db,public From: wardi@rsd.bel.alcatel.be (Ian Ward) Subject: Re: Ada to C/C++ translator needed Date: 1996/09/26 Message-ID: <52e5t5$m28@btmpjg.god.bel.alcatel.be>#1/1 X-Deja-AN: 185487163 distribution: world references: <32499FA0.4B5E@magic.fr> organization: Alcatel Bell Telephone reply-to: wardi@rsd.bel.alcatel.be newsgroups: comp.lang.c,comp.lang.ada Date: 1996-09-26T00:00:00+00:00 List-Id: In article 4B5E@magic.fr, Emmanuel Champommier () writes: >I'm looking for an Ada to C (or C++) translator. > >Does anyone knows where I could find it ? > >Thanks >-- > E. Champommier > (echampommier@magic.fr) > I have seen this request several times, and it seems to me to be not an easy thing to write. Converting 'C' to Ada, I guess involves a lot less donkey work than the other way around. This is because for almost each construct in 'C' and 'C++' (that I can think of,) there is an almost identical construct in Ada, though perhaps with a different syntactical layout. Thus, converting from 'C'/C++ to Ada involves merely rewording the text. (In fact, I have heard that Java is even more similar to Ada, than either 'C' or C++, so presumably this goes for Java as well) Conversely, Ada has features, such as exception handling, range checking, and typing, (not to mention multithreaded tasking, protected and private types, and generics,) that do not simply involve a straight rewording of the code. My guess that writing an Ada to 'C'/C++ to convertor would be almost as difficult as writing a compiler, which is why I have not heard of one. Not only that, but the people who have been writing Ada compilers, while having had a shaky start, (very shaky in the 80's) have basically cracked all the difficult bits of the language (for Ada83 at least) which is why Ada compilers are now more or less on par with 'C' compilers. Starting from scratch into 'C' would take quite some time to approach, I think, the levels of optimisation that a straight compile of the Ada to an object file would take. It would make sense I think, just to link in the object files, assuming you can, to your 'C'. (I say this because I know it is possible with GNAT, but I am not so sure with other compilers. Though I have not come across an Ada compiler yet that could not link the other way.) I think a convertor like this would provide a great many people, a lot of fun to work on. However, it does seem just a bit pointless. As time goes on, it shall become a greater and greater requirement for a language to interface with others, bearing in mind the huge quantities of legacy code, (growing in size every day.) --- Ian Ward's opinions only : wardi@rsd.bel.alcatel.be