Hacker News new | ask | show | jobs
by solarized 364 days ago
Do they use any llm to transpile the C to Rust ?
3 comments

If you're going to use tools to transpile, don't use something that hallucinates. You want it to be precise.

https://github.com/immunant/c2rust reportedly works pretty well. Blog post from a few years ago of them transpiling quake3 to rust: https://immunant.com/blog/2020/01/quake3/. The rust produced ain't pretty, but you can then start cleaning it up and making it more "rusty"

They indeed used c2rust for the initial transpile according to https://trifectatech.org/blog/translating-bzip2-with-c2rust/
So, have the "toxic" people from StackExchange migrated here too? I just asked out of curiosity and got downvoted. :Sigh
Task that requires precision and potentially hard to audit? Exactly where I'd use an LLM /s
Without commenting on whether an LLM is the right approach, I don't think this task is particularly hard to audit. There is almost assuredly a huge test suite for bzip2 archives; fuzzing file formats is very easy; and you can restrict / audit the use of unsafe by the translator.
You’re right, there is a large existing test suite. It’s mentioned in an article linked from this one.

https://trifectatech.org/blog/translating-bzip2-with-c2rust/

I suspect attempting to debug it would be a nightmare though. Given the LLM could hallucinate anything anywhere you’d likely waste a ton of time.

I suspect it would be faster to just try and write a new implementation based on the spec and debug that against the test suite. You’d likely be closer.

In fact, since they used c2rust, they had a perfectly working version from the start. From there they just had to clean up the Rust code and make sure it didn’t break anything. Clearly the best of the three options.

> and you can restrict / audit the use of unsafe by the translator.

No. You need to audit for correctness in additional to safety.