Next: , Previous: , Up: Formal syntax   [Index]


7.1.5 Transformers

Note: Though this grammar does not say so, a top-level syntax-rules pattern must be a list pattern, not a vector pattern or an identifier pattern.

⟨transformer spec⟩ → (syntax-rules (⟨identifier⟩*) ⟨syntax rule⟩*) | (syntax-rules ⟨identifier⟩ (⟨identifier⟩*) ⟨syntax rule⟩*)

⟨syntax rule⟩ → (⟨pattern⟩ ⟨template⟩)

⟨pattern⟩ → ⟨pattern identifier⟩
  | ⟨underscore⟩
  | (⟨pattern⟩*)
  | (⟨pattern⟩+ . ⟨pattern⟩)
  | (⟨pattern⟩* ⟨pattern⟩ ⟨ellipsis⟩ ⟨pattern⟩*)
  | (⟨pattern⟩* ⟨pattern⟩ ⟨ellipsis⟩ ⟨pattern⟩* . ⟨pattern⟩)
  | #(⟨pattern⟩*)
  | #(⟨pattern⟩* ⟨pattern⟩ ⟨ellipsis⟩ ⟨pattern⟩*)
  | ⟨pattern datum⟩

⟨pattern datum⟩ → ⟨string⟩ | ⟨character⟩ | ⟨boolean⟩ | ⟨number⟩ | ⟨bytevector⟩

⟨template⟩ → ⟨pattern identifier⟩ | (⟨template element⟩*) | (⟨template element⟩+ . ⟨template⟩) | #(⟨template element⟩*) | ⟨template datum⟩

⟨template element⟩ → ⟨template⟩ | ⟨template⟩ ⟨ellipsis⟩

⟨template datum⟩ → ⟨pattern datum⟩

⟨pattern identifier⟩ → ⟨any identifier except ...

⟨ellipsis⟩ → ⟨an identifier defaulting to ...

⟨underscore⟩ → ⟨the identifier _