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-18 13:14:23 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!nntp4.savvis.net!uunet!dfw.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: C++ to Ada translator? Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Wed, 18 Sep 2002 20:14:04 GMT References: <1032376330.392712@master.nyc.kbcfp.com> NNTP-Posting-Host: shell01.theworld.com Organization: The World Public Access UNIX, Brookline, MA X-Newsreader: Gnus v5.7/Emacs 20.7 Xref: archiver1.google.com comp.lang.ada:29127 Date: 2002-09-18T20:14:04+00:00 List-Id: Hyman Rosen 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