UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

Program manipulation using a grammar-based meta-programming system Cameron, Robert Douglas


Program manipulation is defined as the automated or semi-automated tailoring, modification or transformation of software to achieve programs with improved performance or other characteristics or to adapt programs to alternative uses. Program manipulation programs (and other sorts of software tool as well) are characterized as "programs about programs" or meta-programs. It is proposed that the implementation of these meta-programs be aided by a new type of meta-tool, the meta-programming system, which is characterized by its systematic treatment of programs as data objects. In support of the meta-programming system concept, a grammar-based scheme (called GRAMPS) for specifying meta-programming systems is put forward. This scheme is illustrated in its particular application to the programming language Pascal (yielding a specification for the meta-programming system Pascal MPS). The suitability of GRAMPS-based systems for implementing meta-programs is evaluated through theoretical consideration of the properties of GRAMPS systems in general, and an analysis of programming experiments using Pascal MPS in particular. The use of meta-programming systems for program manipulation tasks is analysed with respect to several application areas. Meta-programming systems are compared with various alternatives for the implementation of program transformations. Several types of programming utility are discussed including the use of meta-programs to develop versions of target programs specialized for program analysis. The use of meta-programming systems in the implementation of syntactic editors and integrated program manipulation systems is also considered. The results presented support both the GRAMPS scheme itself and the grammar-based treatment of programs as data objects in general. From a theoretical viewpoint, GRAMPS was found to have four important completeness properties. From an experimental perspective, Pascal MPS was found to be generally convenient and practical for large-scale applications. In each of the application areas considered, the meta-programming system approach compared favorably with available alternatives.

Item Media

Item Citations and Data


For non-commercial purposes only, such as research, private study and education. Additional conditions apply, see Terms of Use https://open.library.ubc.ca/terms_of_use.