Object-Oriented Declarative Program Analysis

University dissertation from Department of Computer Science Lund University

Abstract: This thesis deals with techniques for raising the programming level for a particular kind of computations, namely those on abstract syntax trees. Such computations are central in many program analysis tools, such as compilers, smart language-sensitive editors, and static analysis tools. All techniques presented in this thesis support modular description and efficiency and are capable of handling large programs. The work is based on Reference Attributed Grammars (RAGs) which combines object-oriented features with declarative programming to specify computations on abstract syntax trees. RAGs have proven useful, e.g., for performing static-semantic analysis of object-oriented languages. We investigate new applications of RAGs, extensions of RAGs in order to cover yet more applications, modularization issues for RAGs, and implementation of RAG extensions. The thesis consists of an introduction and four papers. The first paper deals with the application of RAGs to a new problem area: program visualization. The second paper describes JastAdd, a practical system for RAGs, based on static aspect-oriented programming and which supports the combination of imperative Java programming with declarative RAG programming. JastAdd has been used for developing practical compilers for full-scale languages. The third paper describes CRAGs, an extension of RAGs allowing circular dependencies and where the evaluator computes fixed-point solutions by iteration. CRAGs open up RAGs for new application areas such as grammar and data flow analyses. The fourth paper deals with extending attribute grammars with collection attributes and circular collection attributes. These attributes allow whole-program properties such as cross-references to be easily specified. A number of evaluation techniques and a number of application areas, including source code metrics, are described. All techniques described in the papers have been implemented and tested in practice.

  This dissertation MIGHT be available in PDF-format. Check this page to see if it is available for download.