I’ve been looking for a free (as in “free beer”) library that can parse C# 3.0 code (actually, C# 2.0 with lambdas would do it) and return some sort of AST/code DOM for a personal project. However, most alternatives I’ve seen up to now are inadequate:
Microsoft.CSharp.CSharpCodeProvider.Parsethrows aNotImpementedException;- Visual Studio’s “exposed” code parser sucks;
- The ways of Mono’s C# compiler are impenetrable (and next to not documented);
- The C# Parser project at CodePlex only parses C# 2.0 code and thus we forget lambdas;
- Another project on SourceForge claims to parse C# to CodeDOM, but it’s 2000 days old so I guess it’s not C# 3.0;
- … and it goes on for several pages of Google results.
So… is there a free, working C# 3.0 parser out there, that can be plugged into another project?
I’ve had good luck with NRefactory, written in C# and used for the SharpDevelop IDE written for Mono:
http://wiki.sharpdevelop.net/NRefactory.ashx