Skip to main content Accesibility Help

Fortifying macros


Existing macro systems force programmers to make a choice between clarity of specification and robustness. If they choose clarity, they must forgo validating significant parts of the specification and thus produce low-quality language extensions. If they choose robustness, they must write in a style that mingles the implementation with the specification and therefore obscures the latter. This paper introduces a new language for writing macros. With the new macro system, programmers naturally write robust language extensions using easy-to-understand specifications. The system translates these specifications into validators that detect misuses—including violations of context-sensitive constraints—and automatically synthesize appropriate feedback, eliminating the need for ad hoc validation code.

Hide All
Culpepper, R. & Felleisen, M. (2004) Taming macros. In International Conference on Generative Programming and Component Engineering, pp. 225–243.
Despeyroux, T. (October 1995) Logical programming and error recovery. Industrial Applications of Prolog.
Dybvig, R. K. (2010) Chez scheme version 8 users's guide. Cadence Research Systems.
Dybvig, R. K., Hieb, R. & Bruggeman, C. (1993) Syntactic abstraction in Scheme. Lisp Symb. Comput. 5 (4), 295326.
Findler, R. B., Clements, J., Flanagan, C., Flatt, M., Krishnamurthi, S., Steckler, P. & Felleisen, M. (2002) DrScheme: A programming environment for Scheme. J. Funct. Program. 12 (2), 159182.
Flatt, M. (2002) Composable and compilable macros: You want it when? In International Conference on Functional Programming, pp. 72–83.
Flatt, M., Barzilay, E. & Findler, R. B. (2009) Scribble: Closing the book on ad hoc documentation tools. In International Conference on Functional Programming, pp. 109–120.
Flatt, M., Findler, R. B. & Felleisen, M. (November 2006) Scheme with classes, mixins, and traits. In Asian Symposium on Programming Languages and Systems, pp. 270–289.
Flatt, M. & PLT. (January 2010) Reference: Racket. Tech. Rep. PLT [online]. Accessed July 2012. Available at:
Ford, B. (September 2002) Packrat Parsing: A Practical Linear-time Algorithm with Backtracking. MPhil thesis, Massachusetts Institute of Technology.
Herman, D. & Wand, M. (March 2008) A theory of hygienic macros. In European Symposium on Programming, pp. 48–62.
Hilsdale, E. & Friedman, D. P. (2000) Writing macros in continuation-passing style. In Workshop on Scheme and Functional Programming, pp. 53–59.
Hughes, J. (1995) The design of a pretty-printing library. In Advanced Functional Programming, First International Spring School on Advanced Functional Programming Techniques: Tutorial Text. London, UK: Springer-Verlag, pp. 5396.
Kohlbecker, E. E. & Wand, M. (1987) Macro-by-example: Deriving syntactic transformations from their specifications. In Symposium on Principles of Programming Languages, pp. 77–84.
Landin, P. J. (1965) Correspondence between ALGOL 60 and Church's lambda-notation: Part I. Commun. ACM 8 (2), 89101.
Le Fessant, F. & Maranget, L. (2001) Optimizing pattern matching. In International Conference on Functional Programming, pp. 26–37.
Owens, S., Flatt, M., Shivers, O. & McMullan, B. (September 2004) Lexer and parser generators in Scheme. In Workshop on Scheme and Functional Programming, pp. 41–52.
Queinnec, C. (1996) Macroexpansion reflective tower. In Proceedings of the Reflection'96 Conference, pp. 93–104.
Shivers, O. (2005) The anatomy of a loop: A story of scope and control. In International Conference on Functional Programming, pp. 2–14.
Sperber, M., Dybvig, R. K., Flatt, M., van Straaten, A., Findler, R. & Matthews, J. (2009) Revised6 report of the algorithmic language Scheme. J. Funct. Program. 19 (S1), 1301.
van den Brand, M. G. J., Scheerder, J., Vinju, J. J. & Visser, E. (2002) Disambiguation filters for scannerless generalized LR parsers. In Compiler Construction. Horspool, N. (ed). Springer-Verlag, pp. 143158.
Wand, M. & Vaillancourt, D. (2004) Relating models of backtracking. In International Conference on Functional Programming, pp. 54–65.
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? *


Full text views

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

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed

Fortifying macros

Submit a response


No Discussions have been published for this article.


Reply to: Submit a response

Your details

Conflicting interests

Do you have any conflicting interests? *