C to Go translation tool supporting Go toolchain migration
github.com
github.com
This translator produces a VERY literal translation, as the intention is for future human passes to clean it up and convert it to more idiomatic go.
See here for the full plan: https://docs.google.com/document/d/1P3BLR31VA8cvLJLfMibSuTdw...
rewriteTypes(cfg, prog)
rewriteSyntax(cfg, prog)
rewriteLen(cfg, prog)
fixGoTypes(cfg, prog)
renameDecls(cfg, prog)
exportDecls(cfg, prog)
writeGoFiles(cfg, prog)
https://github.com/rsc/c2go/blob/f6c077dd7192b90f4a7ad0a4b8f..."Goal: Automated conversion of our C code to Go. Target: our C code, not all C code."
Nice to see that somebody knows how to dig through history.
Some demos are available on his page: https://www.mtsystems.ch
This work is based on the stuff he did for his PhD. I think his largest test case so far is a full translation of VIM.
I'm not sure if I saved time or not (I think I did) for the effective work, but I definitely saved time (and stress) overall, as the conversion was without bugs. I know for sure that I would have introduced a lot of bugs if I did this manually.
Tools that understand source code are great, and I'm really excited about the new Go compilers.
[1] https://code.google.com/p/rbits/source/browse/7lfix/main.go