4 ms·
"a transpiler from C++ to Rust" I think the best approach for something like this is a disassembler for LLVM IR. I am not extremely familiar with the LLVM IR,
by kodablah 13y ago
"a transpiler from C++ to Rust"
I think the best approach for something like this is a disassembler for LLVM IR. I am not extremely familiar with the LLVM IR, but I figure there are common patterns or debug symbols clang produces that could let you get a decent idea of what the higher level gave you. If not targeted to clang output too much, you can then transpile any LLVM-able language to Rust.
I think, but am not sure, that the problem with Rust being a target for these other languages (my pipe dream is to write a JVM in it w/ a JIT using the bootstrapped rustc lib) is that you have to use unsafe code all the time (unless there's 0 performance penalty for ARC) because the original code is not written with ownership/borrowing semantics.
- sanderjd 13y agoI think there are probably lots of chunks of code that would be perfectly valid under Rust's ownership semantics and could therefore be transpiled safely. Figuring out which chunks are and aren't would probably be quite difficult though.
- wtetzner 13y agoOne approach might be to just convert to Rust, and let the Rust compiler tell you what things don't type check.