问题描述
我查看了 http://referencesource.microsoft.com/ 的源代码,它出现了所有源代码都在 C# 中.
I looked at the source code at http://referencesource.microsoft.com/, and it appears all the source code is in C#.
我还查看了新 C# 编译器平台的源代码(Roslyn),它也在 C# 中.这怎么可能?C# 语言编译器是用 C# 编写的吗?还是我错过了一些明显的东西?如果 C# 编译器是用 C# 编写的,那么它是如何工作的?
I also looked at the source code for the new C# compiler platform (Roslyn), and it is also in C#. How is that possible? Is C# language compiler written in C#? Or am I missing something obvious? If C# compiler is written in C# then how does it work?
推荐答案
最初的 C# 编译器不是用 C# 编写的,而是用 C 和 C++ 编写的.新的 Roslyn 编译器是用 C# 编写的,但最初是使用旧编译器编译的.新编译器完成后,就可以编译自己的源代码:这称为 bootstrapping.
The original C# compiler wasn't written in C#, it was in C and C++. The new Roslyn compiler was written in C#, but was initially compiled with the old compiler. Once the new compiler was done, it was able to compile its own source code: this is called bootstrapping.
这篇关于C# 编译器是用哪种语言编写的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!