3 ms·
Yeah I was thinking it might be better to use something like LLVM IR as the “data structure” and then train deep nets to go $(LANG) => IR and then IR => $(LANG)
by malux85 6y ago
Yeah I was thinking it might be better to use something like LLVM IR as the “data structure” and then train deep nets to go $(LANG) => IR and then IR => $(LANG), trained with a lot of idiomatic well written code for each Lang, then the nets might be able to glean the intent more than implementation details.
Not sure though, I’m not an expert in LLVM IR, so I’m not sure how feasible that is...
- loopz 6y agoGood call on LLVM. Was thinking about that too, but had to look up IR. This one looked interesting: https://idea.popcount.org/2013-07-24-ir-is-better-than-assembly/ https://idea.popcount.org/2013-07-24-ir-is-better-than-assem... IR looks to be targetting machine code, so not sure it'll be the right format to embed high-level language concepts.
- londons_explore 6y ago$(LANG) => IR can be done by LLVM itself... And that conversion misses out important details like comments. Perhaps the ideal solution takes as input both the original code and the IR to generate output.
- antoinealb 6y agoThe issue is that LANG -> IR is a lossy transform: some constructs are lost, some language specific optimization passes could be applied, etc. Going from LANG1 -> LANG2 starts with more information, so it could in theory work better.
- webmaven 6y agoIt would be interesting to see what neural translation systems (in general, not just for code) use as an implicit internal IR.
- Certhas 6y agoIt's lossy, the inverse is not well defined. But you could try to train a NN on reconstructing plausible (idiomatic) inputs leading to the current IR...