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: 109fba,94a2b19e68586a6 X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,9adfbb907494972e X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,9adfbb907494972e X-Google-Attributes: gid103376,public From: dewar@schonberg.cs.nyu.edu (Robert Dewar) Subject: Re: Ada to C/C++ translator needed Date: 1996/10/05 Message-ID: #1/1 X-Deja-AN: 187733383 references: <32499FA0.4B5E@magic.fr> <52cdn6$iis@dfw.dfw.net> <3251C855.41C6@etek.chalmers.se> organization: New York University newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++ Date: 1996-10-05T00:00:00+00:00 List-Id: B|rje Norden said I'm not so sure about that; I seem to remember having seen an ADA compiler that generated C code instead of object code (OK, strictly speaking this isn't a translator,but it shows that it's not impossible to develop code in ADA and later convert it to C/C++) No, it does not show anything of the kind. The compilers that have generated C code have done it have generated extremely low level C that you would not think of having a human read. Obviously it is possible in a limited sense to generate output in C syntax that maps the original Ada semantics to C syntax. For instance, you could make a gcc backend, which generated assembler level C: r1 = r2 + r3; if (r1 > 0) goto l345; r4 = mem[sp]; ... etc, but such a "C" program is no more interesting from a maintainability point of view than intermediate assembly language. It is a possible path to an interesting level of portability for the Ada compiler, which is why it has been used for at least one Ada compiler in the past. Apart from ADA's multitasking features,most of the constructs in ADA/C++ is actually quite similar (apart from syntax, that is...); I don't think it would be too difficult to make an ADA to C++ converter if there was a good way of handling the multitasking bits (ADA to C, on the other hand, would be a nightmare to accomplish...;-)). And what do you mean by various market reasons ? Please explain yourself. Actually the multi-tasking parts are the easiest, since they are just library routines that have to be written and then called in the right places. The real difficulty, you actually state: **quite** similar. That **quite** is deadly. It means that the semantics do not correspond exactly, and you will find in practice that once you delve into the details, that this is one of those cases that has given rise to the phrase "the devil is in the details". Writing a complete translator from C++ to Ada 95 (or vice versa) would be very much harder than writing two compilers for each language separately. You would have to understand 100% of the semantics of both languages, and constantly be intermediating fights between them.