Microsoft has open sourced the Common Compiler Infrastructure (CCI) via CCI: Metadata and CCI: Code and AST components. Like other Microsoft’s open source entries, these two are offered under the Microsoft Public License.
The metadata and code components together can write CLR assemblies and debug (PDB) files. This will effectively give us the format of these debug files, which can be quite helpful at times. The Code Model is also a lot easier to use than the IL code and can handle multiple languages. The AST components offer classes which take care of a lot of boiler plate code, like error reporting, etc.
There are some code analysis tools, like FxCop, which use CCI, and Microsoft intends to provide more sample applications for CCI. Microsoft has invested good amount of research in this space and all credit to Microsoft for opening up these projects.