Roslyn 是一个完全独立的 C# 编译器吗?我查看了一下源代码,似乎它使用了 Visual Studio 的编译器,而且,我在它的 GitHub 存储库(https://github.com/dotnet/roslyn)中没有找到任何源代码与解析有关。
是的,Roslyn 是一个完整的 C#(和 VB!)编译器。
作为起点,这里是
csc.exe
的源代码,即实际的编译器二进制文件:https://github.com/dotnet/roslyn/blob/master/src/Compilers/CSharp/csc/Csc.cs
实际的解析器位于:https://github.com/dotnet/roslyn/tree/master/src/Compilers/CSharp/Portable/Parser