Hacker News new | past | comments | ask | show | jobs | submit login

They rewrote the compiler from C to Go.



To be specific I think they used a transpiler, probably Russ Cox's c2go (https://github.com/rsc/c2go).


What's the point of doing that? I get that you want a language to bootstrap itself, but if you skip the experience of actually writing the compiler, and the code you have to maintain is a weird non-idiomatic machine-generated thing, what have you gained?


from https://talks.golang.org/2015/gogo.slide#4

  "Why move the compiler to Go?

  Not for validation; we have more pragmatic motives:
  Go is easier to write (correctly) than C.
  Go is easier to debug than C (even absent a debugger).
  Go is the only language you'd need to know; encourages contributions.
  Go has better modularity, tooling, testing, profiling, ...
  Go makes parallel execution trivial.
  Already seeing benefits, and it's early yet.
  Design document: golang.org/s/go13compiler"
and https://talks.golang.org/2015/gogo.slide#10

  "Why translate it, not write it from scratch? 
  Correctness, testing.
  Steps:
  Write a custom translator from C to Go.
  Run the translator, iterate until success.
  Measure success by bit-identical output.
  Clean up the code by hand and by machine.
  Turn it from C-in-Go to idiomatic Go (still happening)."


More developers (who don't know c (good enough), but are proficient in go) who can contribute to the compiler code long term (and improve the transpiled compiler). Other reasons would interest me as well.


Are there large numbers of people skilled in writing compilers, but don't know C? I doubt it.

That practical point aside, I do think it's good to lower the barrier of contributing.


Yes, I doubt it too. But are they interested in contributing to the go compiler if they don't already do that? I would guess go users are more interested in contributing to go. Plus the compiler people who are good at c and are already contributing can probably get up to speed with go quickly if they want to and don't know go yet. Or they already know go because they use it.


I think it is similar to what some people say that they will contribute to open source project only if it is on github. So it is not logical but nonetheless many want it.


Automatic translation for most of the code where it doesn't make a difference

Then you can get this base and start improving on it


Well, at least I bet the compiler compiles itself faster now :-)




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

Search: