Roslyn C# 编译器是如何引导的?
How's Roslyn C# compiler bootstrapped?
我已经开始阅读有关 "Roslyn" 新 C# 编译器的文章,想知道 Roslyn 编译器是如何编译的?
我明白 boostrapping is needed in order to have "self hosting compiler",我想知道 Roslyn 编译器 "bootstrapped" 怎么样?
我猜测现有的 C# 编译器已用于此。我的意思是,一个完全自举的编译器很好,但在这种情况下并不是真正必要的。
如果还没有现成的语言实现,引导程序只是一个问题。在这种情况下有,所以很容易。
- 使用现有的 C# 编译器编译第一个版本的 Roslyn
- 然后使用新编译的 Roslyn 构建重新编译它。
- 完成。
读一读
http://en.wikipedia.org/wiki/Bootstrapping_%28compilers%29
If one needs to obtain a compiler for language X (which is written in
language X), there is the issue of how the first compiler can be
written. The different methods that are used in practice to solving
this chicken or the egg problem include:
Implementing an interpreter or compiler for language X in language Y.
Niklaus Wirth reported that he wrote the first Pascal compiler in
Fortran.[citation needed] Another interpreter or compiler for X has
already been written in another language Y; this is how Scheme is
often bootstrapped.
但是对于 Roslyn 的具体细节,我猜是用 c# 编译器(Roslyn 之前的版本)构建,然后用它自己构建 :)(前几次运行)一旦稳定,他们可能只是用 Roslyn 构建 Roslyn :)
我也猜它是所有自动化和单元测试的。
这就是 C# 团队实际上(不是猜测)完成的方式,according to Eric Lippert:
C# 1.0 到 5.0 编译器是用 C++ 编写的。在相当长的时间里——一年多——我们用 C# 编写了 Roslyn C# 编译器,并用 C# 4.0 编译了它。 (C# 5.0 由一个姊妹团队并行开发。)我们可以编译 Roslyn 编译器,然后右转并使用我们刚刚构建的编译器再次编译它的那一天,那是快乐的一天。
Nice piece Mads Torgersen 关于引导编译器的商业案例:
"Here, finally was our value proposition: Make it so that there only needs to be one code base in the world that understands C#, shared by everyone who wants to build tools over code!"
我已经开始阅读有关 "Roslyn" 新 C# 编译器的文章,想知道 Roslyn 编译器是如何编译的?
我明白 boostrapping is needed in order to have "self hosting compiler",我想知道 Roslyn 编译器 "bootstrapped" 怎么样?
我猜测现有的 C# 编译器已用于此。我的意思是,一个完全自举的编译器很好,但在这种情况下并不是真正必要的。
如果还没有现成的语言实现,引导程序只是一个问题。在这种情况下有,所以很容易。
- 使用现有的 C# 编译器编译第一个版本的 Roslyn
- 然后使用新编译的 Roslyn 构建重新编译它。
- 完成。
读一读
http://en.wikipedia.org/wiki/Bootstrapping_%28compilers%29
If one needs to obtain a compiler for language X (which is written in language X), there is the issue of how the first compiler can be written. The different methods that are used in practice to solving this chicken or the egg problem include:
Implementing an interpreter or compiler for language X in language Y. Niklaus Wirth reported that he wrote the first Pascal compiler in Fortran.[citation needed] Another interpreter or compiler for X has already been written in another language Y; this is how Scheme is often bootstrapped.
但是对于 Roslyn 的具体细节,我猜是用 c# 编译器(Roslyn 之前的版本)构建,然后用它自己构建 :)(前几次运行)一旦稳定,他们可能只是用 Roslyn 构建 Roslyn :)
我也猜它是所有自动化和单元测试的。
这就是 C# 团队实际上(不是猜测)完成的方式,according to Eric Lippert:
C# 1.0 到 5.0 编译器是用 C++ 编写的。在相当长的时间里——一年多——我们用 C# 编写了 Roslyn C# 编译器,并用 C# 4.0 编译了它。 (C# 5.0 由一个姊妹团队并行开发。)我们可以编译 Roslyn 编译器,然后右转并使用我们刚刚构建的编译器再次编译它的那一天,那是快乐的一天。
Nice piece Mads Torgersen 关于引导编译器的商业案例:
"Here, finally was our value proposition: Make it so that there only needs to be one code base in the world that understands C#, shared by everyone who wants to build tools over code!"