Parser How To in .NET

.net, c#, lexer, parsing

Solution

I personally found this article, Grammars and Parsing with C# 2.0, a great introduction on writing lexers/parsers, with examples specifically relating to C#.

I wrote a brief blog post about it not long ago, doing it praise. The nice thing is that it's very much aimed at complete beginners to parse theory (it gives background to the theory as well as implementation), and takes matters in gradual steps. Of course, if you want to proceed to learn the more advanced ideas of the field, you will need various other resources, but I think this is an excellent foundation.

Problem

I'd like to understand how to construct a parser in .NET to process source files. For example, maybe I could begin by learning how to parse SQL or HTML or CSS and then act on the results to be able to format them for readability or something similar. Where can I learn how to do this? Are there specific books I can refer to? Do I need to learn about lexers/parsers? Specifically for the .NET platform since I'm comfortable in C#.

Original source