( Syntax Rules

Info Catalog ( Macros ( Procedures and Macros ( Syntax Case
 23.6 The R5RS `syntax-rules' System
 R5RS defines an alternative system for macro and syntax transformations
 using the keywords `define-syntax', `let-syntax', `letrec-syntax' and
    The main difference between the R5RS system and the traditional
 macros of the previous section is how the transformation is specified.
 In R5RS, rather than permitting a macro definition to return an
 arbitrary expression, the transformation is specified in a pattern
 language that
    * does not require complicated quoting and extraction of components
      of the source expression using `caddr' etc.
    * is designed such that the bindings associated with identifiers in
      the transformed expression are well defined, and such that it is
      impossible for the transformed expression to construct new
 The last point is commonly referred to as being "hygienic": the R5RS
 `syntax-case' system provides "hygienic macros".
    For example, the R5RS pattern language for the `false-if-exception'
 example of the previous section looks like this:
      (syntax-rules ()
        ((_ expr)
         (catch #t
                (lambda () expr)
                (lambda args #f))))
    In Guile, the `syntax-rules' system is provided by the `(ice-9
 syncase)' module.  To make these facilities available in your code,
 include the expression `(use-syntax (ice-9 syncase))' ( Using
 Guile Modules) before the first usage of `define-syntax' etc.  If you
 are writing a Scheme module, you can alternatively include the form
 `#:use-syntax (ice-9 syncase)' in your `define-module' declaration
 ( Creating Guile Modules).


* Pattern Language            The `syntax-rules' pattern language.
* Define-Syntax               Top level syntax definitions.
* Let-Syntax                  Local syntax definitions.
Info Catalog ( Macros ( Procedures and Macros ( Syntax Case
automatically generated byinfo2html