[Haskell-cafe] Program for displaying graph state in lambda interpreter?

Benjamin Redelings benjamin.redelings at duke.edu
Fri Jun 1 21:54:50 CEST 2012


     I have written an interpreter that operates on the lambda calculus 
augmented with letrec, constructors, case, primitive objects, and 
builtin operations.  I'd like to display the internal state of the 
intepreter at various points so that I can, um, debug the "programs" 
that I've written.

     Currently I've got about 3500 nodes, and I'm dumping a graph that I 
format using the 'dot' program in graphviz.  I might have "let x = 1+2 
in x*x" represented as.

x/1: <2>+<3>
2: 1.0
3: 2.0
4: <1>*<1>

where <1>, <2>, <3>, represent various memory locations.  I can display 
this in graphviz, where each node is a rectangle containing text like 
"<1>*<1>" and there are arrows from the rectangle to <1>.  This works as 
long as the number of nodes isn't very large.

     However, it would be nice to know of any programs that are better 
suited for this.  For example, if I could write <>*<> and draw arrows 
from the placeholders "<>" to the memory location being referenced, that 
would be easier to read.  This is done here 
http://en.wikibooks.org/wiki/Haskell/Graph_reduction to illustrate that 
'square (1+2)' doesn't evaluate 1+2 twice.  Any ideas?



P.S. If this is too off-topic, please let me know.

More information about the Haskell-Cafe mailing list