Go编程语言的编译器是用哪种语言编写的?

huangapple go评论97阅读模式
英文:

What language is the compiler of Go programming language written in?

问题

我认为标题已经很明确了。

英文:

I think the title is self explanatory.

答案1

得分: 169

编程语言不是程序,因此它们不是用任何语言“编写”的。它们通常通过形式语法(例如BNF)来描述。

解释器和编译器用于编程语言的是程序,因此必须用某种编程语言编写。

Go至少有两个编译器,gcgccgo。前者最初是用C编写的,但现在是用Go自身编写的。而后者是一个主要用C++编写的gcc前端。Go的库是用Go编写的。

英文:

Programming languages aren't programs, hence they're not "written" in any language. They are often described by formal grammars (e.g. BNF).

Interpreters and compilers for programming languages are programs and so must be written in some kind of programming language.

Go has at least two compilers, gc and gccgo. The former was written in C, but is now written in Go itself. While the latter is a gcc frontend written mainly in C++. Go's libraries are written in Go.

答案2

得分: 105

查看源代码和C语言,如果我可以这么说。


编辑 Go团队在2013年12月宣布他们将把编译器转换为Go语言。截至2015年2月,编译器已经完全自举,因为C语言实现已经被删除。新的编译器首次随Go 1.5一起发布。

英文:

Look at the source and C for yourself, if I may say.


EDIT The Go team announced in December 2013 that they will be transitioning the compiler to Go. As of February 2015, the compiler is exclusively self-hosting, as the C implementation was deleted. The new compiler shipped for the first time with Go 1.5.

答案3

得分: 17

它是用C语言编写的。这些库本身是用Go语言编写的。

编辑:现在编译器已经被重写为Go语言,因此它完全自主。

英文:

It's written in C. The libraries are written in Go itself.

Edit: Now the compiler has been rewritten in Go, so it is fully self-hosting.

答案4

得分: 2

"go编译器是用go语言和少量汇编语言编写的"
"但是gccgo是用C、C++和go语言编写的"
Rob Pike

英文:

"go compiler written in go and little of assembly"

"but gccgo is written in c c++ and go"

Rob Pike

huangapple
  • 本文由 发表于 2010年7月25日 09:47:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/3327676.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定