comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: C++ to Ada translator?
Date: Wed, 18 Sep 2002 20:14:04 GMT
Date: 2002-09-18T20:14:04+00:00	[thread overview]
Message-ID: <wccwupj9htf.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 1032376330.392712@master.nyc.kbcfp.com

Hyman Rosen <hyrosen@mail.com> writes:

> Ivan Paniagua wrote:
> > I'm looking for a C++ to Ada translator.
> 
> This is essentially impossible to do in a way that would preserve
> the character of the C++ code.

I don't think "preserve the character of the C++" is the goal.
The goal ought to be to produce "good" Ada code, where "good"
is measured with respect to what a good human Ada programmer
would write.  I agree that this is a difficult goal to achieve,
but probably not impossible.  Consider:

    int mumble; /* The value of mumble is always between 1 and 10. */

I would be surprised if a translation tool would generate the
corresponding Ada, which might be:

    type Mumble_Count is range 1..10;
    Mumble: Mumble_Count;

The tranlator would have to understand the comment (!), and would have
to guess whether it means "between 1 and 10 inclusive" versus exclusive,
a job that's hard even for a human.  Or maybe a fancy (inter-module)
flow analysis could determine the right bounds in many cases.  But how
would the tool know when to create new integer types?  And how would it
generate sensible names for them?  I can imagine some heuristics, but it
doesn't sound easy.

On the other hand, it is probably feasible (not trivial!) to do a
translation that doesn't *damage* readability too much with respect to
the original C++.

>... That is, if you wanted to further
> edit the translated code, or even just read it, you would find it
> cryptic and difficult. (I speak here of C++ in its full generality.
> Limited subsets of C++ which avoid its best features will translate
> more readily.)

- Bob



  reply	other threads:[~2002-09-18 20:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-18 13:58 C++ to Ada translator? Ivan Paniagua
2002-09-18 19:12 ` Hyman Rosen
2002-09-18 20:14   ` Robert A Duff [this message]
2002-09-18 20:28     ` Hyman Rosen
2002-09-19 14:29   ` Wes Groleau
2002-09-19 23:28     ` Ira Baxter
2002-09-20 16:12       ` Wes Groleau
2002-09-21 15:54         ` Ira Baxter
2002-09-18 19:50 ` Ira Baxter
2002-09-18 20:18   ` Hyman Rosen
2002-09-18 20:33     ` Robert A Duff
2002-09-19 13:37       ` Hyman Rosen
2002-09-19 13:40     ` Ira Baxter
2002-09-19 14:38       ` Frank J. Lhota
2002-09-19 15:15         ` OT: Russian to English translator? Frank J. Lhota
2002-09-19 17:17           ` Wes Groleau
replies disabled

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