From: dst+@cs.cmu.edu (Dave Touretzky)
Newsgroups: comp.lang.lisp
Subject: free Lisp educational tools available
Keywords: Lisp education, software tools, evaltrace notation
Date: 9 Oct 92 06:51:50 GMT
Article-I.D.: cs.BvuDqF.2q6.2
Organization: School of Computer Science, Carnegie Mellon
Cc: dst@cs.cmu.edu

This is to let people know about some free tools that may be of value to
Lisp educators:  Evaltrace, DTRACE, and SDRAW.  All three were used in my
Lisp book that appeared a couple of years ago.  ("Common Lisp:  A Gentle
Introduction to Symbolic Computation", by David S. Touretzky, The
Benjamin/Cummings Publishing Co., 1990.)  FTP instructions are included at
the end of this message.

1) Evaltrace is a graphical notation for explaining how evaluation works.
It is described in detail in an article in this month's CACM.  ("Visualizing
Evaluation in Applicative Languages", by David S. Touretzky and Peter Lee.
Communications of the ACM, pp. 45-59, October, 1992.)  We have created
special TeX fonts and LaTeX style files that make it easy for people to
generate their own evaltrace diagrams.

2) DTRACE is a "detailed trace" package that generates more useful
information than the tracing tools provided with most Common Lisp
implementations.  It comes in a variety of implementation-specific versions,
some with nice graphics.  It also comes in a "generic" version.  DTRACE
understands optional and keyword arguments, and can trace macros as well as
functions.  Here is an example of the DTRACE output for factorial:

   * (fact 4)
   ----Enter FACT
   |     N = 4
   |   ----Enter FACT
   |   |     N = 3
   |   |   ----Enter FACT
   |   |   |     N = 2
   |   |   |   ----Enter FACT
   |   |   |   |     N = 1
   |   |   |   |   ----Enter FACT
   |   |   |   |   |     N = 0
   |   |   |   |    \--FACT returned 1
   |   |   |    \--FACT returned 1
   |   |    \--FACT returned 2
   |    \--FACT returned 6
   \--FACT returned 24
   24


3) SDRAW is a program that draws cons cell structures.  It comes in
graphical versions (e.g., for X11) as well as a generic version.  It
includes a read-eval-draw loop that is very useful for teaching beginners to
understand the distinctions between CONS, LIST, and APPEND; there is also a
"crawl" program for exploring large structures.  This latest version also
handles circular structures neatly, using #n= notation.  Here is an example
of generic SDRAW output:

   * (sdraw #'fact)
   [*|*]--->[*|*]--------->[*|*]--->NIL
    |        |              |
    v        v              v
   LAMBDA   [*|*]--->NIL   [*|*]--->[*|*]--->[*|*]--->NIL
             |              |        |        |
             v              v        v        v
             N             BLOCK    FACT     [*|*]--->[*|*]--->etc.
                                              |        |
                                              v        v
                                             COND     [*|*]--->etc.
                                                       |
                                                       v
                                                      [*|*]--->[*|*]--->NIL
                                                       |        |
                                                       v        v
                                                      ZEROP     N

................................................................

These tools can be retrieved by anonymous FTP from host B.GP.CS.CMU.EDU
(128.2.242.8), as follows:

 1. ftp b.gp.cs.cmu.edu
    user: anonymous
    password:  yourname@yourhost

 2. binary
    (It is important to set binary mode before retrieving the evaltrace
    file, since it is in compressed format.)

 3. cd /usr/dst/public/lisp
    You must cd directly here; for secureity reasons you can only access
    directories that are children of /usr/dst/public.

    Look at /usr/dst/public/lisp/README for info about DTRACE and SDRAW.

 4. cd /usr/dst/public/evaltrace
    get evaltrace.tar.Z
    quit
    uncompress evaltrace.tar.Z
    tar -xf evaltrace.tar

................................................................

I hope people find these tools useful.  If anyone wants to port SDRAW and
DTRACE to Scheme, I'd love to hear from you.

-- Dave Touretzky
Newsgroups: comp.lang.lisp