► |  | Syntax: Meta-Programming Helpers

1 | Parsing and Specifying Syntax
2 | Syntax Object Helpers
3 | Datum Pattern Matching
4 | Module-Processing Helpers
5 | Macro Transformer Helpers
6 | Reader Helpers
7 | Source Locations
8 | Preserving Source Locations
9 | Non-Module Compilation And Expansion
10 | Trusting Standard Recertifying Transformers
11 | Attaching Documentation to Exports
| Index

▼ | 1 | Parsing and Specifying Syntax

1.1 | Introduction
1.2 | Examples
1.3 | Parsing Syntax
1.4 | Specifying Syntax with Syntax Classes
1.5 | Syntax Patterns
1.6 | Defining Simple Macros
1.7 | Literal Sets and Conventions
1.8 | Library Syntax Classes and Literal Sets
1.9 | Debugging and Inspection Tools
1.10 | Experimental

On this page:

syntax-class-attributes
syntax-class-arity
syntax-class-keywords
syntax-class-parse
debug-parse

top← prev up next →

#### 1.9`` Debugging and Inspection Tools

(require syntax/parse/debug)

The following special forms are for debugging syntax classes.

> > syntax

> > (syntax-class-attributes syntax-class-id)

Returns a list of the syntax class’s attributes. Each attribute entry consists of the attribute’s name and ellipsis depth.

> > syntax

> > (syntax-class-arity syntax-class-id)

> > syntax

> > (syntax-class-keywords syntax-class-id)

Returns the syntax class’s arity and keywords, respectively. Compare with procedure-arity and procedure-keywords.

> > syntax

> > (syntax-class-parse syntax-class-id stx-expr arg ...)

> | stx-expr |  | : |  | syntax?

Runs the parser for the syntax class (parameterized by the arg-exprs) on the syntax object produced by stx-expr. On success, the result is a list of vectors representing the attribute bindings of the syntax class. Each vector contains the attribute name, depth, and associated value. On failure, the result is some internal representation of the failure.

> > syntax

> > (debug-parse stx-expr S-pattern ...+)

> | stx-expr |  | : |  | syntax?

Tries to match stx-expr against the S-patterns. If matching succeeds, the symbol 'success is returned. Otherwise, an S-expression describing the failure is returned.

The failure S-expression shows both the raw set of failures (unsorted) and the failures with maximal progress. The maximal failures are divided into equivalence classes based on their progress (progress is a partial order); that is, failures within an equivalence class have the same progress and, in principle, pinpoint the same term as the problematic term. Multiple equivalence classes only arise from ~parse patterns (or equivalently, #:with clauses) that match computed terms or ~fail (#:fail-when, etc) clauses that allow a computed term to be pinpointed.

top← prev up next →