We kinda gave up on translating C into D, as many C constructs were unduly awkward to represent in D. What's working much better is to incorporate a C compiler directly into the D compiler. No need to translate, and the C semantics can be adhered to exactly. (The D compiler is extended to understand the C semantics coming from the C code, although that isn't part of the D specification.)
We used to call fortran transpired into ada: adatran.<p>Adatran was terrible. Hard to impossible to edit if something needed fixing. Used none of the features that made Ada a decent language. The very limited code they did this to did work however. This was a huge project and included C and ada code.<p>What do we call C code transpiled to Rust. Crust?
Not mentioned on this page is the associated refactoring tool (<a href="https://c2rust.com/manual/c2rust-refactor/index.html" rel="nofollow">https://c2rust.com/manual/c2rust-refactor/index.html</a>) which IME is too complicated to learn in 15 minutes, but would likely be a very useful investment when translating a large code base.
<a href="https://github.com/immunant/c2rust" rel="nofollow">https://github.com/immunant/c2rust</a>:<p>> We rely on Emscripten's Relooper algorithm to translate arbitrary C control flows.<p>Article on why Relooper isn't good enough and the superior Stackifier algorithm, which they probably should be using instead:<p><a href="https://medium.com/leaningtech/solving-the-structured-control-flow-problem-once-and-for-all-5123117b1ee2" rel="nofollow">https://medium.com/leaningtech/solving-the-structured-contro...</a>
This looks more useful than some other C to Rust tools, as this will work on code directly instead of the finally linked product, allowing you to use it to port larger library collections or SDKs ahead of time for use in a subsequent Rust project. This can also be used on any old random snippet of valid C, (known limitations aside)<p>This will be fantastic for helping encourage Rust on microcontrollers. The microcontroller world is very C heavy, so libraries for daughter board and other chips, and other example code, is often only published in C, despite the growing ecosystem of microcontroller chips and boards that have good support for Rust, you end up constantly pushed towards C due to the ecosystem basically only using C. Having a good tool to take that C code and give at least a mechanical, non-idiomatic Rust port is just fantastic and I'm looking forward to giving this a shot with a particular add on board SDK that I wanted to use on a Rust supported microcontroller.
Back in the day there was also Corrode: <a href="https://github.com/jameysharp/corrode" rel="nofollow">https://github.com/jameysharp/corrode</a><p>Discussed here: <a href="https://news.ycombinator.com/item?id=12056230" rel="nofollow">https://news.ycombinator.com/item?id=12056230</a>