comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@schonberg.cs.nyu.edu (Robert Dewar)
Subject: Re: Ada to C/C++ translator needed
Date: 1996/10/05
Date: 1996-10-05T00:00:00+00:00	[thread overview]
Message-ID: <dewar.844515554@schonberg> (raw)
In-Reply-To: 3251C855.41C6@etek.chalmers.se


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.






  parent reply	other threads:[~1996-10-05  0:00 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-09-25  0:00 Ada to C/C++ translator needed Emmanuel Champommier
1996-09-25  0:00 ` David Weller
1996-10-02  0:00   ` B|rje Norden
1996-10-04  0:00     ` David Weller
1996-10-05  0:00     ` Robert Dewar [this message]
1996-10-05  0:00       ` Frank Manning
1996-10-06  0:00         ` Samuel Tardieu
1996-10-07  0:00           ` Richard Kenner
1996-10-07  0:00             ` Robert Dewar
1996-10-08  0:00             ` Stephen Leake
1996-10-07  0:00         ` Robert Dewar
1996-10-08  0:00           ` Frank Manning
1996-10-07  0:00   ` Erik Magnuson
1996-09-26  0:00 ` Ian Ward
     [not found]   ` <52feul$os2@goanna.cs.rmit.edu.au>
1996-09-28  0:00     ` Tim Behrendsen
1996-09-29  0:00       ` Ken Pizzini
1996-09-29  0:00         ` Tim Behrendsen
1996-09-29  0:00           ` Robert Dewar
1996-09-30  0:00             ` Tim Behrendsen
1996-09-30  0:00               ` Matthew Heaney
1996-09-30  0:00                 ` Tim Behrendsen
1996-09-30  0:00               ` William Clodius
1996-10-01  0:00               ` Richard A. O'Keefe
1996-09-30  0:00           ` Richard A. O'Keefe
1996-09-30  0:00             ` Tim Behrendsen
1996-09-30  0:00       ` Richard A. O'Keefe
1996-09-30  0:00         ` Tim Behrendsen
1996-09-30  0:00           ` Peter Seebach
1996-09-30  0:00             ` Tim Behrendsen
1996-10-01  0:00           ` Richard A. O'Keefe
1996-10-01  0:00             ` Tim Behrendsen
1996-10-02  0:00               ` Ian Ward
1996-10-02  0:00                 ` Tim Behrendsen
1996-09-30  0:00         ` Peter Seebach
1996-10-02  0:00           ` Richard A. O'Keefe
1996-10-05  0:00             ` Lawrence Kirby
1996-10-06  0:00     ` Tanmoy Bhattacharya
1996-10-06  0:00       ` Lawrence Kirby
1996-10-08  0:00         ` Peter Seebach
1996-10-07  0:00     ` Tanmoy Bhattacharya
1996-10-02  0:00   ` Jon S Anthony
1996-10-02  0:00   ` Jon S Anthony
  -- strict thread matches above, loose matches on Subject: below --
1996-10-02  0:00 Simon Johnston
1996-10-07  0:00 ` Richard Riehle
1996-10-09  0:00   ` Richard A. O'Keefe
1996-10-15  0:00     ` Tucker Taft
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox