manpagez: man pages & more
info guile
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.10.2 Syntax-rules Macros

syntax-rules macros are simple, pattern-driven syntax transformers, with a beauty worthy of Scheme.

Syntax: syntax-rules literals (pattern template)...

Create a syntax transformer that will rewrite an expression using the rules embodied in the pattern and template clauses.

A syntax-rules macro consists of three parts: the literals (if any), the patterns, and as many templates as there are patterns.

When the syntax expander sees the invocation of a syntax-rules macro, it matches the expression against the patterns, in order, and rewrites the expression using the template from the first matching pattern. If no pattern matches, a syntax error is signalled.


This document was generated on April 20, 2013 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.