Which parsers are available for parsing C# code? [closed]

Works on source code:

  • CSParser:
    From C# 1.0 to 2.0, open-source
  • Metaspec C# Parser:
    From C# 1.0 to 3.0, commercial product (about 5000$)
  • #recognize!:
    From C# 1.0 to 3.0, commercial product (about 900€) (answer by SharpRecognize)
  • SharpDevelop Parser (answer by Akselsson)
  • NRefactory:
    From C# 1.0 to 4.0 (+async), open-source, parser used in SharpDevelop. Includes semantic analysis.
  • C# Parser and CodeDOM:
    A complete C# 4.0 Parser, already support the C# 5.0 async feature. Commercial product (49$ to 299$) (answer by Ken Beckett)
  • Microsoft Roslyn CTP:
    Compiler as a service.

Works on assembly:

The problem with assembly “parsing” is that we have less informations about line and file (the informations is based on .pdb file, and Pdb contains lines informations only for methods)

I personnaly recommend Mono.Cecil and NRefactory.

Leave a Comment