Version: 4.2.1
1 Syntax Object Helpers
1.1 Deconstructing Syntax Objects
Returns
#t if
v is either a pair or a syntax object
representing a pair (see
syntax pair).
Returns
#t if
v is a list, or if it is a sequence of
pairs leading to a syntax object such that
syntax->list would
produce a list.
Produces a list by flatting out a trailing syntax object using
syntax->list.
Returns
#t if
a-id and
b-id are
free-identifier=?, or if
a-id and
b-id have
the same name (as extracted by
syntax-e) and
a-id
has no binding other than at the top level.
This procedure is useful in conjunction with syntax-case* to
match procedure names that are normally bound by MzScheme. For
example, the include macro uses this procedure to recognize
build-path; using free-identifier=? would not work
well outside of module, since the top-level
build-path is a distinct variable from the MzScheme export
(though it’s bound to the same procedure, initially).
1.2 Matching Fully-Expanded Expressions
The trans?-expr boolean expression replaces the comparison
procedure, and instead selects simply between normal-phase comparisons
or transformer-phase comparisons. The clauses are the same as in
syntax-case*.
The primitive syntactic forms must have their normal bindings in the
context of the kernel-syntax-case expression. Beware that
kernel-syntax-case does not work in a module whose language
is mzscheme, since the binding of if from
mzscheme is different than the primitive if.
A syntactic form like
kernel-syntax-case, except that it
takes an additional list of extra literals that are in addition to the
primitive PLT Scheme forms.
Generalizes
kernel-syntax-case to work at an arbitrary phase
level, as indicated by
phase-expr.
Generalizes
kernel-syntax-case* to work at an arbitrary phase
level, as indicated by
phase-expr.
Returns a list of identifiers that are bound normally,
for-syntax, and
for-template to the primitive PLT
Scheme forms for expressions and internal-definition positions (so the
list does not include
#%require or
#%provide). This
function is useful for generating a list of stopping points to provide
to
local-expand.
See also syntax/id-table for an implementation of
identifier mappings using the scheme/dict dictionary
interface.
Produces a hash-table-like value for storing a mapping from syntax
identifiers to arbitrary values.
The mapping uses bound-identifier=? to compare mapping keys,
but also uses a hash table based on symbol equality to make the
mapping efficient in the common case (i.e., where non-equivalent
identifiers are derived from different symbolic names).
Like hash-table-get for bound-identifier mappings.
Like hash-table-put! for bound-identifier mappings.
Like hash-table-for-each.
Like hash-table-map.
Produces a hash-table-like value for storing a mapping from syntax
identifiers to arbitrary values.
The mapping uses free-identifier=? to compare mapping keys,
but also uses a hash table based on symbol equality to make the
mapping efficient in the common case (i.e., where non-equivalent
identifiers are derived from different symbolic names at their
definition sites).
Like hash-table-get for free-identifier mappings.
Like hash-table-put! for free-identifier mappings.
Like hash-table-for-each.
Like hash-table-map.
1.4 Identifier dictionaries
This module provides functionality like that of
syntax/boundmap but with more operations, standard
names, implementation of the scheme/dict interface,
and immutable (functionally-updating) variants.
Bound-identifier tables implement the dictionary interface of
scheme/dict. Consequently, all of the appropriate generic
functions (dict-ref, dict-map, etc) can be used on
free-identifier tables.
Produces a dictionary mapping syntax identifiers to arbitrary
values. The mapping uses
bound-identifier=? to compare keys,
but also uses a hash table based on symbol equality to make the
mapping efficient in the common case. The two procedures produce
mutable and immutable dictionaries, respectively.
The optional init-dict argument provides the initial
mappings. It must be a dictionary, and its keys must all be
identifiers. If the init-dict dictionary has multiple
distinct entries whose keys are bound-identifier=?, only one
of the entries appears in the new id-table, and it is not specified
which entry is picked.
Predicate for the mutable and immutable variants of bound-identifier
tables, respectively.
Like
hash-ref for bound identifier tables. In particular, if
id is not found, the
failure argument is applied if
it is a procedure, or simply returned otherwise.
Like
hash-set! for mutable bound-identifier tables.
Like
hash-set for immutable bound-identifier tables.
Like
hash-remove for immutable bound-identifier tables.
Like
hash-map for bound-identifier tables.
Free-identifier tables implement the dictionary interface of
scheme/dict. Consequently, all of the appropriate generic
functions (dict-ref, dict-map, etc) can be used on
free-identifier tables.
1.5 Rendering Syntax Objects with Formatting
Builds a string with newlines and indenting according to the source
locations in stx-list; the outer pair of parens are not
rendered from stx-list.
1.6 Computing the Free Variables of an Expression
1.7 Replacing Lexical Context
Removes all lexical context from stx, preserving
source-location information and properties.
Uses the lexical context of ctx-stx to replace the lexical
context of all parts of stx, preserving source-location
information and properties of stx.
1.8 Legacy Zodiac Interface
The interface is similar to Zodiac – enough to be useful for
porting – but different in many ways. See the source
"zodiac-sig.ss" for details. New software should not use this
compatibility layer.