comp.lang.ada
 help / color / mirror / Atom feed
From: "Ira Baxter" <idbaxter@semdesigns.com>
Subject: Re: C++ to Ada translator?
Date: Thu, 19 Sep 2002 18:28:54 -0500
Date: 2002-09-19T18:28:54-05:00	[thread overview]
Message-ID: <3d8a5d4d$1@giga.realtime.net> (raw)
In-Reply-To: 3D89DF47.918EE3D1@despammed.com

"Wes Groleau" <wesgroleau@despammed.com> wrote in message
news:3D89DF47.918EE3D1@despammed.com...
>
> > > 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. 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.
>
> I sometimes translate Spanish to English and vice versa.
> I always use one or more auto-tranlating programs first.
> The output is totally unacceptable (see sig for a _mild_
> example) but it gets me to the final result faster than
> if I did the first pass myself.
>
> I expect similar from a C/C++/Java to Ada translator.
>
> --
> Wes Groleau
> The Invisible Idiot
> http://freepages.computers.rootsweb.com/~wgroleau/idiot.html

Translating natural langauges is much harder than translating artificial
computer languages.
Natural languages contain ambiguity, inconsistency (maybe, maybe not),
incredible assumptions about context (this whole newsgroup thread),
broken sentences, mispelings, dialects, ... duh. (:-}).. no wonder they're
hard to translate.
And if you use that as a baseline, yes, I can see how you'd arrive at your
conclusion.

Artificial languages tend not to have most of this junk.  Individual
constructs
in one languge can often be simulated by a modest number of constructs
from another.    A trival "expansive" translation will then lead to code
bloat, but not "wrong answers".  We can argue about readable.

Coupling "naive" translation with post-optimization can strip away
much of the generality that the "number of constructs" bring,
by taking into account constraints imposed by the local code.
With that, you can get code that is arguably readable (as
opposed to unarguably unreadable).  See the example
in the slides found at
http://www.semdesigns.com/Products/Services/LegacyMigration.html.
(This is JOVIAL to C; in fact, if one looks closely, it will
be a bit more unreadable for a C purist because the customer
asked us to retain the JOVIAL type names as macros
for defining variables, to ease the education curve
of his existing JOVIAL team.  All those macro names
are trivially replaceably by their content, e.g,  "I" by "int".

I'll agree that the translated code is not a pretty or nice
as that written by an experienced engineer.   I've seen
much worse code from some so-called "professional" engineers.

--
Ira D. Baxter, Ph.D., CTO   512-250-1018
Semantic Designs, Inc.      www.semdesigns.com






  reply	other threads:[~2002-09-19 23:28 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
2002-09-18 20:28     ` Hyman Rosen
2002-09-19 14:29   ` Wes Groleau
2002-09-19 23:28     ` Ira Baxter [this message]
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