Parser Delegation : An Object-Oriented Approach to Parsing

Conventional grammar specification and parsing is generally done in a monolithic manner, i.e. the syntax and semantics of a grammar are specified in one large specification. Although this might be sufficient in static environments, a modular approach is required in situations where the syntax or semantics of a grammar specification are subject to frequent changes. The problems with monolithic grammars are related to (1) dealing with the complexity, (2) extensibility and (3) reusability. We propose the concept of {\em parser delegation} as a solution to these problems. Parser delegation allows one to modularise and reuse grammar specifications. To achieve this, the notion of a production rule is specialised into (1) overriding, (2) extending and (3) delegating production rule types. To experiment with parser delegation, we have developed D-yacc, a graphical tool for defining grammars. Parser delegation has been applied for constructing a translator for an experimental language and is currently applied in other domains.