* Ada to C translator @ 1997-01-21 0:00 Gabriel Rouzaut 1997-01-22 0:00 ` Larry Kilgallen 0 siblings, 1 reply; 6+ messages in thread From: Gabriel Rouzaut @ 1997-01-21 0:00 UTC (permalink / raw) 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. I was told that some Ada compilers use C as intermediate language before compilation. Does anybody know one?. Thanks ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Ada to C translator 1997-01-21 0:00 Ada to C translator Gabriel Rouzaut @ 1997-01-22 0:00 ` Larry Kilgallen 1997-01-24 0:00 ` Ted Dennison ` (3 more replies) 0 siblings, 4 replies; 6+ messages in thread From: Larry Kilgallen @ 1997-01-22 0:00 UTC (permalink / raw) In article <32E4C115.55BD@iies.es>, Gabriel Rouzaut <gabmrou@iies.es> 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. > I was told that some Ada compilers use C as intermediate language > before compilation. Does anybody know one?. I don't know of any, but sometimes such reports are confused due to the fact that Ada compilers and C compilers use a common back end. Examples are GNAT and DEC Ada. In each case the back end has to include at least some Ada-specific features, which some might views as "proof by example" that a general purpose Ada-to-C translator is not possible. Larry Kilgallen ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Ada to C translator 1997-01-22 0:00 ` Larry Kilgallen @ 1997-01-24 0:00 ` Ted Dennison 1997-01-30 0:00 ` Keith Thompson ` (2 subsequent siblings) 3 siblings, 0 replies; 6+ messages in thread From: Ted Dennison @ 1997-01-24 0:00 UTC (permalink / raw) Larry Kilgallen wrote: > > In article <32E4C115.55BD@iies.es>, Gabriel Rouzaut <gabmrou@iies.es> 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. > > > I was told that some Ada compilers use C as intermediate language > > before compilation. Does anybody know one?. > > I don't know of any, but sometimes such reports are confused due > to the fact that Ada compilers and C compilers use a common back > end. Examples are GNAT and DEC Ada. In each case the back end > has to include at least some Ada-specific features, which some > might views as "proof by example" that a general purpose Ada-to-C > translator is not possible. This is one of the better explanations I have seen on this subject. It would be a good candidate for inclusion in the c.l.a FAQ (hint hint). -- T.E.D. | Work - mailto:dennison@escmail.orl.lmco.com | | Home - mailto:dennison@iag.net | | URL - http://www.iag.net/~dennison | ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Ada to C translator 1997-01-22 0:00 ` Larry Kilgallen 1997-01-24 0:00 ` Ted Dennison @ 1997-01-30 0:00 ` Keith Thompson [not found] ` <32F5DB0D.66D9@stgl.sel.alcatel.de> [not found] ` <5d29nv$sqv@mn5.swip.net> 3 siblings, 0 replies; 6+ messages in thread From: Keith Thompson @ 1997-01-30 0:00 UTC (permalink / raw) In <1997Jan22.062734.1@eisner> kilgallen@eisner.decus.org (Larry Kilgallen) writes: [...] > 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. I don't agree that a general purpose translator is impossible. After all, we know that a general purpose Ada to machine code translator is possible, and machine code does not inherently support tasking. The trick is that you'd have to find a way to support or emulate tasking (and other Ada-specific features) in the generated C. The logical way to do this is to generate calls to runtime support routines, possibly written in Ada. Of course, this doesn't imply that an Ada to C translator is necessarily a good idea. Generating legible and maintainable C from Ada is a daunting task. Even if you could do it, it would be sort of like transmuting gold into lead. 8-)} There have been proposals to use C as an intermediate language to simplify porting an Ada compiler to new architectures. I don't know how practical this turned out to be. Note that C code generated as an intermediate language is almost certain to be illegible and unmaintainable. -- Keith Thompson (The_Other_Keith) kst@aonix.com <http://www.aonix.com> <*> TeleSo^H^H^H^H^H^H Alsy^H^H^H^H Thomson Softw^H^H^H^H^H^H^H^H^H^H^H^H^H Aonix 10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2706 "SPOON!" -- The Tick ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <32F5DB0D.66D9@stgl.sel.alcatel.de>]
* Re: C to Ada translator (was: Ada to C translator) [not found] ` <32F5DB0D.66D9@stgl.sel.alcatel.de> @ 1997-02-07 0:00 ` Howard W. LUDWIG 0 siblings, 0 replies; 6+ messages in thread From: Howard W. LUDWIG @ 1997-02-07 0:00 UTC (permalink / raw) Martin Krueger wrote: > > Larry Kilgallen wrote: > > > > In article <32E4C115.55BD@iies.es>, Gabriel Rouzaut <gabmrou@iies.es> 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <5d29nv$sqv@mn5.swip.net>]
[parent not found: <dewar.854940250@merv>]
[parent not found: <5ddp0u$elq@mn5.swip.net>]
* Re: Ada to C translator [not found] ` <5ddp0u$elq@mn5.swip.net> @ 1997-02-09 0:00 ` Robert Dewar 0 siblings, 0 replies; 6+ messages in thread From: Robert Dewar @ 1997-02-09 0:00 UTC (permalink / raw) <<As Ada is so different from C it is quite natural that Ada translated into C looks horrible to a C programmer :-) gi-go>> Well I know there is a smiley there, but still, this statement is highly misleading. The issue here has to do with much more fundamental issues than Ada being different from C, it has to do with a mismatch in semantic level for certain operations that leads to C that looks horrible to anyone. For example, because of the need to do overflow checking, we may well have to translate: x := (a * b) + (c * d); to x = PLUSOV (MULTOV (a, b), MULTOV (c,d)); where PLUSOV and MULTOV are macros that use operators like :? to check for overflow. There are many other such cases to be dealt with. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1997-02-09 0:00 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 1997-01-21 0:00 Ada to C translator Gabriel Rouzaut 1997-01-22 0:00 ` Larry Kilgallen 1997-01-24 0:00 ` Ted Dennison 1997-01-30 0:00 ` Keith Thompson [not found] ` <32F5DB0D.66D9@stgl.sel.alcatel.de> 1997-02-07 0:00 ` C to Ada translator (was: Ada to C translator) Howard W. LUDWIG [not found] ` <5d29nv$sqv@mn5.swip.net> [not found] ` <dewar.854940250@merv> [not found] ` <5ddp0u$elq@mn5.swip.net> 1997-02-09 0:00 ` Ada to C translator Robert Dewar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox