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,4039d4e40ecde64c X-Google-Attributes: gid103376,public From: "Howard W. LUDWIG" Subject: Re: C to Ada translator (was: Ada to C translator) Date: 1997/02/07 Message-ID: <32FB5BD2.A79@ccmail.orl.mmc.com>#1/1 X-Deja-AN: 215183221 references: <32E4C115.55BD@iies.es> <1997Jan22.062734.1@eisner> <32F5DB0D.66D9@stgl.sel.alcatel.de> content-type: text/plain; charset=us-ascii organization: Lockheed Martin Electronics & Missiles mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.02 (Win16; I) Date: 1997-02-07T00:00:00+00:00 List-Id: Martin Krueger wrote: > > Larry Kilgallen wrote: > > > > In article <32E4C115.55BD@iies.es>, Gabriel Rouzaut writes: > > > Does anybody knows any tool to translate Ada source files to > > > C/C++ source files?. I was looking for it on the net, but I > > > couldn't find any. > > > > The consensus in comp.lang.ada from the _many_ times this has been > > addressed in the past is that no general purpose translator could > > be built since the semantics of Ada are a superset of the semantics > > of C or C++ (no tasking for example). Please read archives of the > > comp.lang.ada rather than starting the discussion up from scratch. > > > > As Ada is the superset, is it then possible to translate C-code in Ada? > I could make use of such a translator to facilitate the rewriting of a > (supposedly buggy) C-library in Ada. > > M A R T I N > > -- > _____ > Dr. Martin Krueger |.---.| > Alcatel SEL AG, TS/PF ||___|| |\__/,| (`\ > D-70435 Stuttgart |o --|\ |o o |__ _) ) > :=====: ) _.( T ) ` / > +49 711 821-49003, Fax:46776 (_ ((_ `^--' /_< \ > martin.krueger@stgl.sel.alcatel.de /_/ `-'(((/ (((/ The Ada FAQ addresses reasons for not translating from language x to Ada. In particular, one basically has an x-based design expressed in Ada syntax. Thus, one does not have the advantages offered by Ada for maintnenance, reuse, etc. Also, the code was probably originally written to support optimization by an x compiler but the translated code does not typically fit well with optimization by an Ada compiler. (The traditional example between Fortran and Ada 83 involves the use of multidimensional arrays and what order the indexes should be in for optimized throughput.) However, the situation discussed in the original post is even more troublesome because of the reference to "buggy". Are the problems relatively simple typographical issues (such as == versus = in a conditional or how many asterisks for how many levels of pointer dereferencing) or are they fundamental design flaws (the boundary between the two being rather fuzzy)? If there is the suspicion of design flaws, I expect one would be better off redesigning basically from scratch with Ada concepts in mind. Otherwise, one simply translates flaws from one language to Ada and in a manner where Ada cannot offer its usually superior error-checking capability. Perhaps there is in this case an issue of a very large library and only a few errors so the only viable way to handle that many lines of code within a certain budget or time frame is to get help from an automated process. However, I would be very careful about using that as an excuse to not evaluate critically the design from an Ada standpoint and consider starting from scratch. (At least the requirements for what the library needs to do should stay intact.) Howard W. LUDWIG, Ph.D. Howard_W_Ludwig@ccmail.orl.mmc.com