[plt-scheme] getting a parse tree with bindings info

From: John Clements (clements at brinckerhoff.org)
Date: Tue May 20 13:23:26 EDT 2003

On Tuesday, May 20, 2003, at 12:07  PM, Neil W. Van Dyke wrote:

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> A lot of the Scheme programming tools I want to write need to work
> directly with the source code, but using the variable bindings and
> syntax extension information that is resolved by syncheck.ss.
> I suspect I want a parse tree that's annotated with bindings resolution
> and source position information.
> Should I just clone the syncheck.ss code and adapt it?  Or is there
> already an easier way to get at the information?

Have you tried simply examining the result of 'expand'?  That is, 
expand takes a syntax object or s-expression and coerces it (including 
macro-expansion) into a syntax object in the core forms of MzScheme.  
This syntax object is annotated with source positions and binding 
information.  In fact, DrScheme has a notion of display for such 
objects; if the result of evaluation is a syntax object, DrScheme will 
expose a certain amount of information about that object in a graphical 

To put it another way, I think you will find that the 'interesting' 
part of the computation performed by syncheck (that is, the association 
of bindings with variables and the expansion of macros) is performed by 
a call to 'expand'.

Hope this helps,

john clements

Posted on the users mailing list.