Thank you for the MWE.
The problem is that the transformer environment (the lexical
environment in which the transformer procedure is expanded) is, in
general, different from the runtime environment. In "minimal.scm",
"underscore?" does not belong to the transformer environment (in R6RS
language: its binding lives in another phase).
There are two solutions: You can use "eval-when", which is not
standardized, though, or you put "underscore?" in its own library. In
the latter case, the R6RS expander will visit that library in the
correct phase because it notices that "underscore?" is referenced
inside aa macro transformer.
That worked once I put (define-auxiliary-keywords ..1 ..= ..* @) in the guards.scm module and exported them from there! But with Chez I still ran into the same problem where it complained about ..1 symbol syntax not being allowed under #!r6rs, so I guess this route won't work for anything but underscore. So we are back to making substitutions.
(If, in that case, "underscore?" is also referenced by runtime code,
the library will be made available in two phases.)
Marc
PS I will try to explain all this in detail in my upcoming document on
Scheme macro systems, especially er-macro-transformer and syntax-case.
Note that these phasing issues are related to procedural macros (and
the module system), but are the same whether one uses
er/ir/sc-macro-transformers or syntax-case.