Hostname: page-component-6766d58669-nf276 Total loading time: 0 Render date: 2026-05-17T10:11:43.261Z Has data issue: false hasContentIssue false

Macros that Work Together

Compile-time bindings, partial expansion, and definition contexts

Published online by Cambridge University Press:  09 May 2012

MATTHEW FLATT
Affiliation:
University of Utah (e-mail: mflatt@cs.utah.edu, ryan@cs.utah.edu, david.darais@gmail.com)
RYAN CULPEPPER
Affiliation:
University of Utah (e-mail: mflatt@cs.utah.edu, ryan@cs.utah.edu, david.darais@gmail.com)
DAVID DARAIS
Affiliation:
University of Utah (e-mail: mflatt@cs.utah.edu, ryan@cs.utah.edu, david.darais@gmail.com)
ROBERT BRUCE FINDLER
Affiliation:
Northwestern University (e-mail: robby@eecs.northwestern.edu)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the 'Save PDF' action button.

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.

Information

Type
Articles
Copyright
Copyright © Cambridge University Press 2012
Submit a response

Discussions

No Discussions have been published for this article.