LISP and Symbolic Computation, 5(4)295-326
Syntactic Abstraction in Scheme
R. Kent Dybvig, Indiana University Computer Science Department, Bloomington, IN 47405
Robert Hieb, Indiana University Computer Science Department, Bloomington, IN 47405
Carl Bruggeman, Indiana University Computer Science Department, Bloomington, IN 47405
Abstract: Naive program transformations can have surprising
effects due to the interaction between introduced identifier
references and previously existing identifier bindings, or between
introduced bindings and previously existing references. These
interactions can result in inadvertent binding, or capturing, of
identifiers. A further complication is that transformed programs may
have little resemblance to original programs, making correlation of
source and object code difficult. This article describes an efficient
macro system that prevents inadvertent capturing while maintaining the
correlation between source and object code. The macro system allows
the programmer to define program transformations using an
unrestricted, general-purpose language. Previous approaches to the
capturing problem have been inadequate, overly restrictive, or
inefficient, and the problem of source-object correlation has been
largely unaddressed. The macro system is based on a new algorithm for
implementing syntactic transformations and a new representation for
syntactic expressions.
Keywords: syntactic abstraction, macros, program
transformation, hygienic macros
|
[local copy]
|
|