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

    Go is so close to C. Wouldn’t it be great if there was a program that could take C code and turn it into Go code?
    
    There are few attempts to do that:
    
    https://github.com/rsc/c2go
    https://github.com/elliotchance/c2go
    https://github.com/cznic/ccgo
    elliotchance/c2go seems to be the most promising.
    
    I didn’t try any of them as neither seems to be usable yet.
Actually, we used github.com/rsc/c2go to port our Go compilers and linkers from C to Go. It was 100% mechanical translation. No manual steps needed to achieve correctness.

github.com/cznic/ccgo was used to port sqlite to Go. It passes all the (very comprehensive) sqlite test suite.

They work very well. The code produced is not very idiomatic Go, but it's not some monstrous impenetrable computer generated code either. It's quite similar to the original C code and it's readable and refactorable enough. After we converted the compiler from C to Go, we spent a lot of time to make the code more idiomatic.



>github.com/cznic/ccgo was used to port sqlite to Go.

Where is the result of this? Is it publicly available?





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

Search: