DrScheme expander language
Monday, November 10, 2003
I posted my "Where is macroexpand in PLT Scheme?" question (that I was commenting on yesterday) to the PLT Scheme mailing list and got some interesting replies. In DrScheme, the implementers have taken the novel approach of creating an expander language for Scheme. Basically, to use it, you just select "Expander" as the language (under "Choose Language...") in DrScheme. You then load a Scheme source file and press the Execute button. This will result in the "syntax objects" that make up the Scheme source file being displayed (in a collapsed form) in the Interaction window. You can open up each "syntax object" (there is one for each top-level sexp) and view the expanded source for the sexp. In addition, on the right-hand side of the expanded source display, there is some general information about the sexp (things like the source file, module, location in file, original source statement).
There are some things that I don't like about the approach they've taken (in particular, I would have preferred to see an "expand-to-top-form" type of expansion instead of the "intermediate" form that they've chosen); however, I think that what they've done is unique (I haven't seen any other editor take this type of appoach for any other language). The things I like about it are:
- It gives a syntactic decomposition of the entire program so the programmer can see dependencies
- It presents an informative and innovative way of documenting the syntax objects that make up the program
- It provides the programmer with an alternative representation of the program by breaking it down into the underlying components

