This is really cool. Writing a compiler in the language that you're compiling seems kind of meta. The language has evolved to a point to where it can consume and build itself. Far out mannnnn.
Thanks Go team!
This is really cool. Writing a compiler in the language that you're compiling seems kind of meta. The language has evolved to a point to where it can consume and build itself. Far out mannnnn.
Thanks Go team!
https://groups.google.com/forum/#!msg/golang-dev/6obxRcm-rqc...
Those tools do not use the Go compiler. They're using go/ast or go/types. So the translation of gc from C to Go can't have affected them.
It's been done before, for more than one language, IIRC.
The technique by which they make an executable of a compiler for language L on platform B, using an existing executable of the same compiler for L on platform A, together with the source code of the compiler for L on A, is also cool. I forget the full details right now. Maybe someone else will pitch in and explain. It's called bootstrapping. It's also related to cross-compiling.
Update: Looked it up in Google:
https://en.wikipedia.org/wiki/Bootstrapping_(compilers)
https://en.wikipedia.org/wiki/Cross_compiler
Also see Canadian Cross under above article - this is like the cool technique I talked about above, but more complex.
https://www.ece.cmu.edu/~ganger/712.fall02/papers/p761-thomp...
Unless you think Ken somehow backdoored the original C compilers to backdoor every C compiler in the world to backdoor the Go compilers that came about decades later. :-)
Or is that something that isn't really possible?