Go编程语言的编译器是用什么语言编写的?

发布于 2024-09-11 15:08:31 字数 19 浏览 6 评论 0原文

我认为标题是不言自明的。

I think the title is self explanatory.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

浪漫之都 2024-09-18 15:08:31

编程语言不是程序,因此它们不是用任何语言“编写”的。它们通常用形式语法(例如 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.

蹲墙角沉默 2024-09-18 15:08:31

请自行查看源代码和 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.

等待圉鍢 2024-09-18 15:08:31

它是用 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.

看海 2024-09-18 15:08:31

“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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文