Meet Roslyn Syntax API
Abstract
Until recently the biggest challenge for metaprogramming in .NET was that there was not a decent C# parser that could have been used to parse C# programs with confidence and keep up with the modifications made in the language specification. Some companies and individuals (including yours truly) have had to write their own parser to parse C# source code—because parsing is the first step to analyzing source code. Till Roslyn came into picture, compilers used to be like black boxes. Source code used to go at one end, and machine instructions/executibles came out the other end. However, in parsing code, compilers gained lot of knowledge, all of which used to get lost in the process. This knowledge could have served as the basis for writing analyzers.