Which parsers are available for parsing C# code?
I'm looking for a C# parser that can be used in C# and give me access to line and file informations about each artefact of the analysed code.
Which parsers are available for parsing C# code?
I'm looking for a C# parser that can be used in C# and give me access to line and file informations about each artefact of the analysed code.
Works on source code:
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.
If you're familiar with ANTLR, you can use Antlr C# grammar.
Consider to use reflection on a built binary instead of parsing the C# code directly. The reflection API is really easy to use and perhaps you can get all the information you need?
http://www.codeplex.com/csparser
GPPG might be of use, if you are willing to write your own parser (which is fun).
Maybe you could try with Irony on irony.codeplex.com.
It's very fast and a c# grammar already exists.
The grammar itself is written directly in c# in a BNF like way (acheived with some operators overloads)
The best thing with it is that the "grammar" produces the AST directly.