Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I was just recently wondering if an LSTM neural net could be trained as a decent decompiler from LLVM IR to Rust source. Feed that with Clang output of an established OS and coreutils(i was thinking minix3 but maybe seL4) and get a working if not necessarily idiomatic Rust OS. Refactor at leisure.


Like other commenter said, it would be unreadable. You'd be better off using a transformation system like Semantic Designs DMS or Stratego language with heuristics. Series of rules, analyses, and transforms applying until new code exists.

Real problem with your scheme is that the typing and structure are important to effectively using Rust. Those that you get in LLVM will be nothing like what you would want in Rust and you'll need additional information. In other words, source to source with annotations is a better option.


Why would you ever do that? You'd end up a bunch of unreadable rust code wrapped in a gigantic unsafe {} block.


The LSTM would be trained against an existing high quality Rust code base and it's IR; so I wouldn't expect a bunch of unsafe literal translations.

Whether the C side IR has enough debug metadata or could be annotated automatically would be the make or break.


Perhaps unrealistic, but a brilliant concept.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: