[plt-scheme] Macro stepper question

From: David Van Horn (dvanhorn at cs.brandeis.edu)
Date: Mon Nov 20 15:28:26 EST 2006

Eli Barzilay wrote:
> * DrScheme now has a macro stepper that traces through macro expansion
>   step by step.  The graphical display uses colors to illustrate
>   bindings and a side-panel to display additional syntax information.
>   For additional information and an illustrated introduction, see
>     http://www.ccs.neu.edu/home/ryanc/macro-stepper

When a macro expands into a use of another macro (potentially another 
instance of the original macro), the stepper seems to take the expansion 
of this macro as an atomic step rather than stepping through its 
expansion as well.  This makes stepping through syntax-rules macros 
uninformative, at least for a style I frequently use with syntax-rules. 
  For example:

(define-syntax rev
   (syntax-rules ()
     ((rev xs)
      (rev xs ()))
     ((rev () rxs)
      (quote rxs))
     ((rev (x . xs) rxs)
      (rev xs (x . rxs)))))

(rev (3 2 1)) ;; => '(1 2 3)

Stepping through this, I see:

    (rev (3 2 1))
-> (rev (3 2 1) ())
-> (quote (1 2 3))

I'd like to see:

    (rev (3 2 1))
-> (rev (3 2 1) ())
-> (rev (2 1)  (3))
-> (rev (1)  (2 3))
-> (rev () (1 2 3))
-> (quote  (1 2 3))

Is it possible to have the macro stepper perform the latter set of 
transformations?

Thanks,
David



Posted on the users mailing list.