2 ms·
It's exposed through Roslyn (I was technically wrong in that it's not included in the language, but in Visual Studio). It's not very well-documented (to give yo
by copsarebastards 12y ago
It's exposed through Roslyn (I was technically wrong in that it's not included in the language, but in Visual Studio). It's not very well-documented (to give you some idea of how not well-documented it is, some of the most useful documentation is in a Word file[1]). The code is Open Source[2].
I found out about Roslyn through hearing Erik Meijer speak at a conference. A quick search shows that the content of his talk at the conference I went to is probably covered in his C9 lectures[3], probably in Chapter 8[4]. But I'm pretty sure that will only cover the parser combinators, which is the algorithm, but not the specifics, of how C# is parsed.
When I was doing C# parsing I was working with the CodeDom[5]. If you just need the AST I think ExpressionTrees[6] are now the idiomatic way to generate it, but I'm not sure how that relates to Roslyn.
Disclaimer: My day-to-day development switched over to primarily C/Python/JS about a year and a half ago, so it's been a while since I fired up Visual Studio. My knowledge is probably out of date, and might be flat wrong--nobody's memory is great after a year and a half.
[1] http://msdn.microsoft.com/en-us/hh543916 http://msdn.microsoft.com/en-us/hh543916
[2] https://github.com/dotnet/roslyn https://github.com/dotnet/roslyn
[3] https://channel9.msdn.com/Series/C9-Lectures-Erik-Meijer-Functional-Programming-Fundamentals https://channel9.msdn.com/Series/C9-Lectures-Erik-Meijer-Fun...
[4] https://channel9.msdn.com/Series/C9-Lectures-Erik-Meijer-Functional-Programming-Fundamentals/C9-Lectures-Dr-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-8-of-13 https://channel9.msdn.com/Series/C9-Lectures-Erik-Meijer-Fun...
[5] https://msdn.microsoft.com/en-us/library/y2k85ax6.aspx https://msdn.microsoft.com/en-us/library/y2k85ax6.aspx
[6] https://msdn.microsoft.com/en-us/library/bb397951.aspx https://msdn.microsoft.com/en-us/library/bb397951.aspx