I've had a couple ideas for modifications to the Scheme reader that I imagine would be front-ends to the compiler.  Examples:

1. A front end which reads Scheme source but specially handles square braces, transforming them into Objective-C method calls via my library, so that I can put the following in a program:

   (let ((s [[NSString alloc] initWithCapacity:42]))
      ...)

And have it dispatch non-dynamically (my current project is completely dynamic).

2. A testing library where "check" forms appear under each function in the same file as documentation.  The check forms normally expand to nothing, but a command can be run from the command line scans the current directory and sub-directories for .scm files which (check ...) forms in them and runs them.

3. A complete environment with support for a lot of SRFI's and utility functions built in - a new REPL/compiler which is specialized for some domain.

Black hole appears to do something like this.

My question is, how do I hook into Gambit to compile or interpret after I've transformed the code, preserving line numbers?