3 ms·
So, why didn't you write a parser to convert your C code to Go?
by homebru 15y ago
So, why didn't you write a parser to convert your C code to Go?
- gte910h 15y agoThe point is to learn the language...I don't see writing an automatic converter in a non-go language a good way to learn go.
- kkowalczyk 15y ago(the author of the article here). One, this was an opportunity to learn Go. Two, writing a converter is way above my head and quite likely theoretically (and practically) impossible. I've definitely had to make some decisions that I don't think even the cleverest compiler could (like noticing that array.[c|h] and buffer.[c|h] could be replaced with native Go arrays/slices easily so I didn't have to port that at all, just change the callers to Go equivalents).
- nvictor 15y agoI am impressed with the AppEngine version of our beloved (now dead) JoS forum. Great job.
- kristianp 15y agoI was curious, so I looked it up: http://blog.kowalczyk.info/software/fofou/manifesto.html http://blog.kowalczyk.info/software/fofou/manifesto.html
- alttab 15y agoI interpreted his comment as "it doesn't look like you learned Go." If you are porting direct C logic to Go you could be missing a lot of potential idioms that could differentiate Go from C or python further. You said yourself it was easier to implement parsing with slices. I think a more effective task is "understand what the 4k lines of C do, and then throw it away and re-write it as if it was written in Go in the first place." Your miles may vary.
- scott_s 15y agoI think you mean compiler - a parser just outputs an AST. Anyway, while some of the transformations are probably mechanical, I imagine that the semantic analysis required to recognize the C implementations of a growable array would be more effort than just doing it by hand.
- deleted 15y ago[deleted]