Skip to content

Instantly share code, notes, and snippets.

Portable syntax-case

Abdulaziz Ghuloum, R. Kent Dybvig

The portable syntax-case macro system implements the restricted high-level syntax-rules and equally high-level but general-purpose syntax-case macros of the Revised Report on Scheme (R6RS). It also implements R6RS libraries and all built-in R6RS syntactic forms.

The system is documented in the R6RS and also described, with numerous examples, in Section 3.1 and Chapter 8 of The Scheme Programming Language, 4th edition.

Aspects of the macro system and its implementation are described in Syntactic abstraction in Scheme. Additional example

Emacs support for (Petite) Chez Scheme

If you're running Linux, you already have Emacs. If you're running some other Unix variant, you can obtain it from http://www.gnu.org/software/emacs. If you're running Windows, you can obtain it from http://www.gnu.org/software/emacs/windows/ntemacs.html and get additional help for installing Emacs on Windows from http://w3.trib.com/~ccurley/emacs.html.

There are three levels of customization you might want to run Chez Scheme or Petite Chez Scheme under Emacs: quick and dirty, iuscheme, or insane. If you are running Petite Chez Scheme instead of Chez Scheme, you'll need to make a small additional customization.

Quick and Dirty Setup

If you're not yet comfortable with Emacs and you don't want to make your emacs very customized (in order to stay somewhat standard), just add the following three lines to your emacs configuration file