Practical metaprogramming

  • Authors:
  • James R. Cordy;Medha Shukla

  • Affiliations:
  • Queen's University, Kingston, Canada;Queen's University, Kingston, Canada

  • Venue:
  • CASCON '92 Proceedings of the 1992 conference of the Centre for Advanced Studies on Collaborative research - Volume 1
  • Year:
  • 1992

Quantified Score

Hi-index 0.00

Visualization

Abstract

Metaprogramming is the process of specifying generic software source templates from which classes of software components, or parts thereof, can be automatically instantiated to produce new software components. Metaprograms are specified in an annotated by-example style accessible to ordinary programmers of the source language. Annotations are in the form of Prolog-like predicates that specify the conditions under which different parts of the source template are to be instantiated. Instantiation of a source component is done by specifying facts about the new application in a database, from which the appropriate instance of the metaprogram is automatically inferred using Prolog-style deduction.This paper describes a practical metaprogramming system being developed as part of the ITRC Software Life Cycle Technology project, which utilizes source transformation to implement all phases of the metaprogramming process. Metaprograms are automatically transformed into TXL (Tree Transformation Language) source transformation tasks that automatically implement the instantiation process using TXL. Examples are shown of the use of metaprogramming in automatically deriving C language glue routines that allow Prolog programs to access the GL graphics library.