4 ms·
There is an automated tool - c2rust[1], automating a huge chunk of the translation from C to Rust. Moreover, it has a refactoring tool[2] that is scriptable in
by xvilka 7y ago
There is an automated tool - c2rust[1], automating a huge chunk of the translation from C to Rust. Moreover, it has a refactoring tool[2] that is scriptable in Lua. One of the good examples of such conversion (still not finished though), while still producing the same output is a rewrite[3][4] of XeTeX engine to Rust (as part of Tectonic[5] engine). It is able to parse arXiv articles dump and generate valid PDFs still.
There is some concept[6] of converting Java to Rust, but it is far from being as useful as c2rust tool. Would be nice to integrate with c2rust somehow, if someone wants to help.
[1] https://github.com/immunant/c2rust https://github.com/immunant/c2rust
[2] https://c2rust.com/manual/c2rust-refactor/index.html https://c2rust.com/manual/c2rust-refactor/index.html
[3] https://github.com/tectonic-typesetting/tectonic/issues/459 https://github.com/tectonic-typesetting/tectonic/issues/459
[4] https://github.com/crlf0710/tectonic/tree/oxidize https://github.com/crlf0710/tectonic/tree/oxidize
[5] https://tectonic-typesetting.github.io/en-US/ https://tectonic-typesetting.github.io/en-US/
[6] https://github.com/aschoerk/converter-page https://github.com/aschoerk/converter-page
- peatmoss 7y agoI’ve sort of wondered if there isn’t a possibility for ML driven decompilers that produce idiomatic source code from a given byte code.
- svat 7y agoI wrote a comparison of the quality of this autogenerated C2rust code versus the original sources (WEB code in this case), the last time this was posted: https://news.ycombinator.com/item?id=21176806 https://news.ycombinator.com/item?id=21176806 (Though it's not a fair comparison as this particular automatic translation itself started from automatically translated C code, for unclear reasons.)
- xvilka 7y agoProbably because there is no automated translator from WEB? And unlikely there will ever be.
- duneroadrunner 7y agoLast time I looked at it, c2rust translated from C to unsafe Rust, right? I'll point out a (neglected) project[1] to (partially) auto convert from C to a safe subset of C++. For example, if you need a png encoder/decoder library written in C++, perhaps the safest one is here [2]. [1] https://github.com/duneroadrunner/SaferCPlusPlus-AutoTranslation https://github.com/duneroadrunner/SaferCPlusPlus-AutoTransla... [2] https://github.com/duneroadrunner/SaferCPlusPlus-AutoTranslation/tree/master/examples/lodepng/lodepng_translated https://github.com/duneroadrunner/SaferCPlusPlus-AutoTransla...