[Pretty-Printer home page]

The parser

        This parser is a part of the NMutator project and I first implements the pretty-printer because I needed it to perform mutation testing and to test the parser. The first version I made was a recurcive decending paser which was entirely hand-coded. But the experience shows that it is very difficult to handle everything. In this version I modified the parser of mono (C# compiler for linux) so that it builds my own syntactic tree. I modified a few things in the tokenizer, and I used jay (YACC port to C#, olso part of the mono project) to generate a parser that builds a syntactic tree. This version can (normally) handle every construction of the C# grammar. Figure 1 shows the UML classes diagram of the syntactic tree produced by the parser.


Figure 1 - Classes diagram of the syntactic tree

In the produced syntactic tree every construction of the C# language has it own class. Every node ineherit from CSNode and nodes that support C# attributes inherits from AttributedNode, this is not shown on Figure 1 to simplfy the diagram. You can find the soource code of all of this on my download page.

[Pretty-Printer home page]