Am So., 3. Mai 2020 um 11:06 Uhr schrieb Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de>:

[...]
 
I bet that implementing identifier macros in any Scheme system is a
work of less than one day each. Already now every Scheme system
handles macro keywords, which are not in head position, (usually by
throwing an error). To make it usable in systems without
ER-MACRO-TRANSFORMER and SYNTAX-CASE, a top-level pattern in
SYNTAX-RULES, which just consists of an identifier has to be allowed
(as all other patterns won't match).

To prove that my bet is not insubstantial, I have attached a patch for the Chicken implementation of Scheme. With the patch (it may need to be polished by the maintainers of Chicken), transformers associated with keywords are now also invoked when the keyword is not in head position.

The following example will expand `foo' into #f and display "foo" on the console.

(define-syntax foo
  (er-macro-transformer
    (lambda (x r c)
      (display x)
      (newline)
      #f))

foo

Although I have just installed the Chicken source code, which is still alien to me, it took me less than two hours to get the thing done.  I shouldn't be a hurdle for other implementations as well.

Marc