Re: C++ to D converter based on clang
On Wednesday, 1 June 2016 at 06:45:09 UTC, Jacob Carlborg wrote: On 2016-05-28 13:02, Loïc HAMOT wrote: Hello, I am working on a C++ to D converter. The project is opensource, on github : https://github.com/lhamot/CPP2D Is there a reason to reinvent the wheel instead of contributing to DStep [1]? [1] https://github.com/jacob-carlborg/dstep Hello Jacob. It think DStep and CPP2D have very different objectives. DStep target C and Objective-C headers, but CPP2D target C++ full source code. Maybe do you think I could participate to DStep in order to extend it to full C++ source handling? Yes I could. Like I could participate to VisualD/cpp2d or magicport2 projects. But the reason why I didn't is I want to test the feasibility of a C++ to D conversion using the clang parser. Now, I think I passed the proof of concept step, and merge my work in an other project is not out of the question.
Re: C++ to D converter based on clang
On Saturday, 28 May 2016 at 11:26:23 UTC, Seb wrote: On Saturday, 28 May 2016 at 11:02:37 UTC, Loïc HAMOT wrote: Hello, I am working on a C++ to D converter. The project is opensource, on github : https://github.com/lhamot/CPP2D [...] If somebody is interested to use this software, or to participate, do not hesitate to contact me. Regards That's a great project! IIRC Walter still searches for someone to convert the dmd backend to D. Btw do you know about Daniel's porting tool that was used to migrate the dmd frontend to D? https://github.com/yebblies/magicport2 I gave a try to magicport2, but I read it is specifically done for DMD. Moreover is seams to have some limitations which don't fit for my needs : template, C++11, ... I also tried the cpp2d project inside VisualD. But is has also many limitations in the C++ features it can parse (and the parser is pretty hard to extend). This is why I finally decided to use an existing, robust and reusable C++ parser : clang. I am far away to be able to convert the full DMD backend, but this is a very interesting challenge!
C++ to D converter based on clang
Hello, I am working on a C++ to D converter. The project is opensource, on github : https://github.com/lhamot/CPP2D Clang is used to parse the C++ code and get the abstract syntax tree. Then I can visit the AST to print it to D language. Some tricks are used to convert the simplest macros to mixin. Some C++ features which are not straightforward to convert are already handled, like (A not exhaustive list): class constructor/destructor virtual abstract override initialization list call base constructor Operator overloading member free left or right Template function function specialization class class/struct specialization class/struct partial specialization arrays static dynamic Some examples here : https://github.com/lhamot/CPP2D/wiki/Conversion-samples If somebody is interested to use this software, or to participate, do not hesitate to contact me. Regards