Skip to main content
Log in

Syntactic abstraction in scheme

  • Published:
LISP and Symbolic Computation

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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Steele Jr., Guy L.Common Lisp, the Language. Digital Press, second edition (1990).

  2. Barendregt, H. P.The Lambda Calculus: Its Syntax and Semantics. Elsevier Science Publishers, revised edition (1984).

  3. Bawden, Alan and Rees, Jonathan. Syntactic closures. InProceedings of the 1988 ACM Conference on Lisp and Functional Programming (July 1988) 86–95.

  4. Clinger, William. Hygienic macros through explicit renaming.LISP Pointers, 4, 4 (1991).

    Google Scholar 

  5. Clinger, William and Rees, Jonathan. Macros that work. InConference Record of the Eighteenth Annual ACM Symposium on Principles of Programming Languages (January 1991) 155–162.

  6. Clinger, William, Rees, Jonathan,et al. The revised4 report on the algorithmic language Scheme.LISP Pointers, 4, 3 (1991).

    Google Scholar 

  7. Coutant, D., Meloy, S., and Ruscetta, M. DOC: A practical approach to source-level debugging of globally optimized code. InProceedings of the SIGPLAN '88 Conference on Programming Language Design and Implementation (July 1988) 125–134.

  8. Dybvig, R. Kent.The Scheme Programming Language. Prentice-Hall (1987).

  9. Dybvig, R. Kent.Writing Hygienic Macros in Scheme with Syntax-Case. Technical Report 356, Indiana Computer Science Department (June 1992).

  10. Dybvig, R. Kent, Friedman, Daniel P., and Haynes, Christopher T. Expansion-passing style: Beyond conventional macros. InProceedings of the 1986 ACM Conference on Lisp and Functional Programming (1986) 143–150.

  11. Dybvig, R. Kent, Friedman, Daniel P., and Haynes, Christopher T. Expansion-passing style: A general macro mechanism.Lisp and Symbolic Computation, 1, 1 (1988) 53–75.

    Google Scholar 

  12. Griffin, Timothy G.Definition and Top-Down Refinement for Interactive Proof Development Systems. PhD thesis, Cornell University (August 1988).

  13. Hanson, Chris. A syntactic closures macro facility.LISP Pointers, 4, 4 (1991).

  14. Hennessy, J. Symbolic debugging of optimized code.ACM Transactions on Programming Languages and Systems, 4, 3 (July 1982) 323–344.

    Google Scholar 

  15. Kohlbecker, Eugene.Syntactic Extensions in the Programming Language Lisp. PhD thesis, Indiana University, Bloomington (August 1986).

    Google Scholar 

  16. Kohlbecker, Eugene and Wand, Mitchell. Macro-by-example: Deriving syntactic transformations from their specifications. InConference Record of the Fourteenth Annual ACM Symposium on Principles of Programming Languages (1987) 77–84.

  17. Kohlbecker, Eugene, Friedman, Daniel P., Felleisen, Matthias, and Duba, Bruce. Hygienic macro expansion. InProceedings of the 1986 ACM Conference on Lisp and Functional Programming (1986) 151–161.

  18. Stoy, Joseph E.Denotational Semantics: The Scott-Strachey Approach to Programming Language Theory. MIT Press (1977).

  19. Zellweger, P. An interactive high-level debugger for control-flow optimized programs. InProceedings of the ACM Software Engineering Symposium on High-Level Debugging (August 1983) 159–171.

Download references

Author information

Authors and Affiliations

Authors

Additional information

This material is based on work supported by the National Science Foundation under grant number CCR-8803432.

Robert Hieb died in an automobile accident in April 1992.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Dybvig, R.K., Hieb, R. & Bruggeman, C. Syntactic abstraction in scheme. Lisp and Symbolic Computation 5, 295–326 (1993). https://doi.org/10.1007/BF01806308

Download citation

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01806308

Keywords

Navigation