Collection of Great Applications and Programs using Macros

Culpepper & Felleisen, Fortifying Macros, ICFP 2010

Culpepper, Tobin-Hochstadt and Felleisen, Advanced Macrology and the Implementation of Typed Scheme, Scheme Workshop 2007

Flatt, Findler, Felleisen, Scheme with Classes, Mixins, and Traits, APLAS 2006

Herman, Meunier, Improving the Static Analysis of Embedded Languages via Partial Evaluation, ICFP 2004


Shivers, Carlstrom, Gasbichler & Sperber (1994 & later) The Scsh Reference manual.

Has a lot of good examples of using macros to embed mini-languages into Scheme. Introduced me to the technique of defining macros that implicitly quote their argument. Look at the use of process forms, regular expressions, and the awk-like mini-languages. Scsh is my recommendation as a starting point for playing with macros.

Hilsdale & Friedman (2000) Writing Macros in Continuation-Passing Style.

Shows how the weak syntax-rules macros can be made powerful using continuation-passing style. Gives plenty of examples.

Flatt, Culpepper, Darais & Findler (submitted) Macros that Work Together - Compile-Time Bindings, Partial Expansion, and Definition Contexts.

Provides an overview of, and semantics for the approach to macros in Racket/PLT Scheme. Not a whole lot of examples, but I think the paper has something you are looking for.


ReadScheme! Remember to check the extensive bibliography on ReadScheme.

http://library.readscheme.org/page3.html

One example I think you missed is embedding SQL syntax into Scheme. http://repository.readscheme.org/ftp/papers/sw2002/schemeunit-schemeql.pdf

Macros are also used to write supports for automated testing.


Not a Scheme, but somewhat similar Lisp dialect with a very extensive use of macros: http://www.meta-alternative.net/mbase.html

There are macros implementing various kinds of pattern matching, list comprehensions, various parsers generators (including a PEG/Packrat implementation), embedded Prolog, ADT visitors inference (like scrap your boilerplate in Haskell), extensible syntax macros, Hindley-Milner type system, Scheme-like syntax macros, and many more. Parts of that functionality can be potentially ported to Scheme, other parts needs an extended macro system with explicit context.


I would add "The Scheme standard library itself" to the list. Look at the file boot-9.scm in the guile distribution. Many of the most commonly-used Scheme forms - case, and, etc. - are defined there as macros.