[plt-scheme] Emacs tags for MzScheme modules

From: Eli Barzilay (eli at barzilay.org)
Date: Sat Nov 1 20:54:06 EST 2003

On Nov  1, Bill Clementson wrote:
> > Otherwise you're probably better of writing a Scheme script that
> > will do it (read module contents, get the syntax objects that are
> > toplevel definitions, create tags) -- if this important to you, I
> > have some code that I use to document Swindle that does that sort
> > of thing.
> 
> Yes, that would be great. If it isn't much trouble for you to pull
> it out of Swindle, I would appreciate it.  Thanks for your help.

I don't know how useful this bit would be, but the main point of it
is something like this:

  (define (get-module-data file)
    (let* ((expr (expand (with-input-from-file file read)))
           (comp (compile expr)))
      (define (prop p) (syntax-property expr p))
      (let ((req  (prop 'module-direct-requires))
            (sreq (prop 'module-direct-for-syntax-requires))
            (vars (prop 'module-variable-provides))
            (syns (prop 'module-syntax-provides)))
        `((file            ,file)
          (requires        ,req)
          (syntax-requires ,sreq)
          (variables       ,vars)
          (syntaxes        ,syns)))))

This is a very small part of what you'd want to do.  I doesn't handle
things like re-exported and renamed variables module paths etc etc
etc.  The full version is at:

  http://www.cs.cornell.edu/eli/Swindle/make

and the function is `get-module-data'.  But what you'll want is
something similar that manipulates syntax objects with source
information.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.