skip to main content
Syntactic extensions in the programming language LISP
Publisher:
  • Indiana University
  • Indianapolis, IN
  • United States
Order Number:UMI Order No. GAX86-27998
Bibliometrics
Skip Abstract Section
Abstract

The traditional macro processing systems used in Lisp-family languages have a number of shortcomings. We identify five problems with the declaration tools customarily available to programmers. First, the declarations themselves are hard to read and write. Second, the declarations provide little explicit information about the form macro calls are to take. Third, syntactic checking of macro calls is usually ignored. Fourth, the notion of a macro binding for an identifier gives rise to a poor understanding of what macros really should be. Fifth, the unrestricted capabilities of the language used to declare macros cause some to take advantage of macros in ways inconsistent with their role as textual abstractions. Furthermore, the conventional algorithm used for the expansion of macro calls within Lisp often causes the inadvertent capture of an identifier appearing within the macro call by a macro-generated, binding instance of the same identifier. Lisp programmers have developed a few techniques for avoiding this problem, but they all have depended upon the macro writer taking some sort of special preventative action.We examine several existing macro processors, both inside and outside of the Lisp-family. We then enumerate a set of design principles for macro processing systems. These principles are general enough that they apply to the organization of macro processing systems for a large number of high-level languages. Taking our principles as guidelines, we design a new macro processing system for Lisp. The new macro declaration tool addresses each of the five problems from which the traditional tools suffer. A description of the use of our tool and an annotated presentation of its implementation are provided. We also develop a new macro expansion algorithm that eliminates the capturing problem. The macro expander has the responsibility for avoiding the unwanted capture of identifiers appearing within macro calls.

Cited By

  1. ACM
    Burmako E Scala macros: let our powers combine! Proceedings of the 4th Workshop on Scala, (1-10)
  2. ACM
    Tobin-Hochstadt S, St-Amour V, Culpepper R, Flatt M and Felleisen M Languages as libraries Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation, (132-141)
  3. ACM
    Tobin-Hochstadt S, St-Amour V, Culpepper R, Flatt M and Felleisen M (2019). Languages as libraries, ACM SIGPLAN Notices, 46:6, (132-141), Online publication date: 4-Jun-2011.
  4. Sperber M, Dybvig R, Flatt M, Van straaten A, Findler R and Matthews J (2009). Revised6 report on the algorithmic language scheme, Journal of Functional Programming, 19:S1, (1-301), Online publication date: 1-Aug-2009.
  5. ACM
    Dybvig R The development of Chez Scheme Proceedings of the eleventh ACM SIGPLAN international conference on Functional programming, (1-12)
  6. ACM
    Dybvig R (2006). The development of Chez Scheme, ACM SIGPLAN Notices, 41:9, (1-12), Online publication date: 16-Sep-2006.
  7. Calcagno C, Taha W, Huang L and Leroy X Implementing multi-stage languages using ASTs, Gensym, and reflection Proceedings of the 2nd international conference on Generative programming and component engineering, (57-76)
  8. ACM
    Tucker D and Krishnamurthi S Pointcuts and advice in higher-order languages Proceedings of the 2nd international conference on Aspect-oriented software development, (158-167)
  9. ACM
    Waddell O and Dybvig R Extending the scope of syntactic abstraction Proceedings of the 26th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, (203-215)
  10. Abelson H, Dybvig R, Haynes C, Rozas G, Adams Iv N, Friedman D, Kohlbecker E, Steele G, Bartley D, Halstead R, Oxley D, Sussman G, Brooks G, Hanson C, Pitman K and Wand M (1998). Revised Report on the Algorithmic Language Scheme, Higher-Order and Symbolic Computation, 11:1, (7-105), Online publication date: 1-Aug-1998.
  11. ACM
    Steele G and Gabriel R The evolution of Lisp History of programming languages---II, (233-330)
  12. ACM
    Tessman T (1995). Adding generic functions to Scheme, ACM SIGPLAN Notices, 30:4, (45-50), Online publication date: 1-Apr-1995.
  13. ACM
    Bove A and Arbilla L A confluent calculus of Macro expansion and evaluation Proceedings of the 1992 ACM conference on LISP and functional programming, (278-287)
  14. ACM
    Bove A and Arbilla L (2019). A confluent calculus of Macro expansion and evaluation, ACM SIGPLAN Lisp Pointers, V:1, (278-287), Online publication date: 1-Jan-1992.
  15. ACM
    Abelson H, Dybvig R, Haynes C, Rozas G, Adams N, Friedman D, Kohlbecker E, Steele G, Bartley D, Halstead R, Oxley D, Sussman G, Brooks G, Hanson C, Pitman K, Wand M, Clinger W and Rees J (1991). Revised4 report on the algorithmic language scheme, ACM SIGPLAN Lisp Pointers, IV:3, (1-55), Online publication date: 1-Jul-1991.
  16. ACM
    Yigit O (1988). Readings in scheme, ACM SIGPLAN Lisp Pointers, 2:1, (56-61), Online publication date: 1-Jul-1988.
  17. ACM
    Kohlbecker E and Wand M Macro-by-example: Deriving syntactic transformations from their specifications Proceedings of the 14th ACM SIGACT-SIGPLAN symposium on Principles of programming languages, (77-84)
  18. ACM
    Humphrey S and Krovetz B (1987). SELECTED AI-RELATED DISSERTATIONS, ACM SIGART Bulletin:100, (25-31), Online publication date: 1-Apr-1987.
  19. ACM
    Rees J and Clinger W (1986). Revised3 report on the algorithmic language scheme, ACM SIGPLAN Notices, 21:12, (37-79), Online publication date: 1-Dec-1986.
Contributors
  • Indiana University Bloomington

Recommendations