The design and implementation of a parser and front-end for the iso c++ language and validation of the parser

In this thesis, we address the problems associated with the early phases of compiler development for object-oriented languages: lexical analysis, parsing and construction of a parser front-end. We first show that many language constructs for object-oriented languages cannot be parsed using only syntactic information. We then describe a technique for parsing ambiguous language constructs that exploits semantic information previously gathered in the parse. To demonstrate the effectiveness of the technique we apply it to a language that is notoriously difficult to parse, the C++ programming language. We show that the technique permits parsing of ambiguous C++ constructs in the grammar provided in the ISO C++ standard without modifying, refactoring or extending the grammar. We then describe a dynamic, automated technique for validating the parser, including the development of a technique that permits validation of class invariants that are not initially valid. The algorithm for this technique accepts, as input, a formal specification of the invariants for the important classes and class hierarchies in the system. The algorithm produces, as output, a validator that exercises these invariants as part of the testing process.