About the Curry Term Graph Visualizer

This tool can be used to visualize smaller computations of Curry programs as a slide show. It was created by Sascha Ecks in the context of a bachelor's thesis supervised by Prof. Michael Hanus at the CAU Kiel.

Usage

Just enter a Curry program (see below) and a main expression that should be evaluated into the corresponding fields. With the default "term graph" option, the computation's term graphs are displayed as actual graphs so that the sharing of common subexpressions (see example program "AndShare") as well as non-deterministic computations are visualized. Non-determinism is represented by explicit choice nodes (labelled with "?") which are processed by pull-tab steps when they occur in demanded argument positions (see example program "PullTabbing").

The option "term graph as tree" displays the term graphs as trees, where shared nodes are displayed multiple times (using colors to identify shared nodes). To avoid infinitely deep tree representations of term graphs in case of cyclic graphs (see example programs "CyclicOneTwo" or "CyclicTrues"), a maximum depth for the generated tree representations has to be specified if this option is selected.

The option "with node IDs" adds a unique number to the label of each node. This is useful to identify the nodes between different computation steps, even if their label was changed by a graph rewrite step.

Furthermore, the maximum number of execution steps is always limited to avoid infinite computations. The limit can be set manually but cannot exceed 200 steps.

Requirements on Curry programs

Since the tool is intended to visualize small computations, there are some restrictions on the Curry programs to be executed. The entered Curry program must define all operations, i.e., it should not use any operations from imported modules. From the standard prelude, only data types but no operations can be used (a few exceptions are described below). Have a look at the various example programs provided by the tool.

The provided main expression is evaluated to head normal form only, i.e., it stops if no program rule can be applied to the root of the expression. In order to evaluate an expression to a normal form, one can wrap the main expression with the prelude operation normalForm (see, for instance, example program "ZipOnes"). To support the evaluation to normal form, the tool also supports the prelude operations normalForm, $!, $!!, seq, and apply.

Before execution, the given Curry program is compiled into the intermediate ICurry representation of programs. For instance, locally defined operations are transformed into top-level operations with unique names and operations containing nested patterns in the left-hand sides of their rules are translated into operations with simpler pattterns by introducing auxiliary operations. Hence, operations with new names might occur during a computation.

Symbols used in the term graph

The following symbols are used in the visualized graphs:

The user interface of the term graph slide show

For explanations on the UI elements of the graph slide show, please refer to the following screenshot:

Screenshot of the slideshow