Skip to main content
×
Home
    • Aa
    • Aa

Macros that Work Together: Compile-time bindings, partial expansion, and definition contexts

  • MATTHEW FLATT (a1), RYAN CULPEPPER (a1), DAVID DARAIS (a1) and ROBERT BRUCE FINDLER (a2)
Abstract
Abstract

Racket is a large language that is built mostly within itself. Unlike the usual approach taken by non-Lisp languages, the self-hosting of Racket is not a matter of bootstrapping one implementation through a previous implementation, but instead a matter of building a tower of languages and libraries via macros. The upper layers of the tower include a class system, a component system, pedagogic variants of Scheme, a statically typed dialect of Scheme, and more. The demands of this language-construction effort require a macro system that is substantially more expressive than previous macro systems. In particular, while conventional Scheme macro systems handle stand-alone syntactic forms adequately, they provide weak support for macros that share information or macros that use existing syntactic forms in new contexts. This paper describes and models features of the Racket macro system, including support for general compile-time bindings, sub-form expansion and analysis, and environment management. The presentation assumes a basic familiarity with Lisp-style macros, and it takes for granted the need for macros that respect lexical scope. The model, however, strips away the pattern and template system that is normally associated with Scheme macros, isolating a core that is simpler, can support pattern and template forms themselves as macros, and generalizes naturally to Racket's other extensions.

Copyright
Linked references
Hide All

This list contains references from the content that can be linked to their source. For a full set of references and notes please see the PDF or HTML where available.

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

R. Kent Dybvig , Daniel P. Friedman & Christopher T. Haynes (1988) Expansion-passing style: A general macro mechanism. LISP Symb. Comput. 1 (1), 5375.

R. Kent Dybvig , R. Hieb & C. Bruggeman (1993) Syntactic abstraction in Scheme. LISP Symb. Comput. 5 (4), 295326.

M. Flatt (2002) Compilable and composable macros, you want it when? In Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming (ICFP 2002), Pittsburgh, PA, USA, October 4–6, pp. 7283.

E. Eugene Kohlbecker & M. Wand (1987) Macro-by-example: Deriving syntactic transformations from their specifications. In Proceedings of the 14th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, Munich, Germany, January 2123, pp. 7784.

Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×

Metrics

Full text views

Total number of HTML views: 0
Total number of PDF views: 3 *
Loading metrics...

Abstract views

Total abstract views: 117 *
Loading metrics...

* Views captured on Cambridge Core between September 2016 - 30th March 2017. This data will be updated every 24 hours.