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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e7f5eed426d6145 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-19 16:27:10 PST From: "Ira Baxter" Newsgroups: comp.lang.ada References: <1032376330.392712@master.nyc.kbcfp.com> <3D89DF47.918EE3D1@despammed.com> Subject: Re: C++ to Ada translator? Date: Thu, 19 Sep 2002 18:28:54 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 NNTP-Posting-Host: t1-30.realtime.net Message-ID: <3d8a5d4d$1@giga.realtime.net> X-Trace: giga.realtime.net 1032478029 t1-30.realtime.net (19 Sep 2002 18:27:09 -0500) Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!giga.realtime.net!not-for-mail Xref: archiver1.google.com comp.lang.ada:29199 Date: 2002-09-19T18:28:54-05:00 List-Id: "Wes Groleau" 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