Automated translation from C++ to D

Sean Kelly sean at f4.ca
Tue Feb 21 10:41:09 PST 2006


Georg Wrede wrote:
> On Feb 3, in this newsgroup, Walter wrote:
> 
>> 1) It's written in Java, which is the easiest code to translate to D
>> besides C, perhaps even easier (no macros <g>). Furthermore, Kris has
>> written a tool to automate some of the translation. Automated
>> translation from C++ is essentially impossible.
> 
> Hardly anybody would disagree there!
> 
> But, (hey, it's me talking, what can you expect? ;-)  ) since you have 
> both a C++ compiler and a D compiler, would the following tack cut it:
> 
> Compile the C++ "half-way" (your choice of which passes), and then 
> translate that to D source code?

I think templates would likely cause some problems.  And the 
preprocessor code shouldn't be processed completely.  And then there's 
copy semantics and all the operator overloads D doesn't support.  I 
can't claim to have nearly as much experience as Walter, but this sounds 
like a nightmare.  C to D sounds much more achievable, but even that 
required a modified C preprocessor to accomplish.

> Would there be any very different issues if this is done using Digital 
> Mars compilers versus GCC?

Probably not.  The language spec doesn't vary from platform to platform, 
only the compiler implementation.


Sean



More information about the Digitalmars-d mailing list