A tool for implementing action graphs Philippa Gardner 1 Michael Norrish 2 Andrei Serjantov Computer Laboratory, University of Cambridge Cambridge CB2 3QG, United Kingdom 14 January 2000 Abstract We describe a specification tool for action graphs, which allows the user to naturally switch be- tween between the syntactic and graphical presentations. The implementation includes a general matching algorithm for identifying redexes in a graph, and for animating reductions. Introduction Milner introduced action calculi [6] as a framework for describing models of interactive behaviour, where a graph corresponds to a process and the dynamics (or reduction) of a graph corresponds to interaction between processes. Milner’s motivation arose in part from analysing graphs associated with the -calculus [7], which are not immediately apparent from the -calculus syntax. We describe a specification tool for action graphs, which allows easy movement between the syntax and the graphs, and mimics our natural way of working with the framework. The static encoding of action terms as graphs is well-understood, and the implementation of this aspect of the tool was comparatively easy. However, work on the implementation of the dynamics led to a realisation that this was less well understood theoretically. Our subsequent work on matching (used to find redexes in terms) is both novel and expected to drive further theoretical investigations. Action Graphs Action graphs are used to describe various types of interaction, including imperative features, func- tional computation and interaction described by calculi based on the -calculus. We introduce action graphs by comparing them with Klop’s term rewriting graphs since his approach is nearest to ours in the literature. We should emphasise that Klop’s motivation for studying such graphs is different from ours: term graphs describe term rewriting systems and focus on confluent rewriting; action graphs describe interactive behaviour and are inherently non-confluent. Term graphs In Figure 1, we give some examples of term graphs, with Klop’s syntax for describing such graphs written underneath. The first graph illustrates that a node, in this case , can be shared. The third illustrates that it is also possible to have cycles. Klop’s syntax is a special case of the more familiar syntax. For example the third graph can be written There are two natural equalities associated with such graphs: the standard equality, and an equality given by unwinding the graphs. A simple case of the unwinding equality on term graphs is that Figures 1(a) and 1(b) are equal. Action graphs Simple action graphs are similar to term graphs. For example, the action graph in Figure 2(a) corresponds to the term graph in Figure 1(c). Compare the syntactic descriptions of the two approaches. Klop denotes the node by , whereas we use the notation . Klop uses to denote the root of the graph, whereas we have the interface . Action graphs are more expressive than term graphs. For example, action graphs allow the interfaces to nodes and graphs to be more general. This is illustrated in Figure 2(b) where node , described by , has two outport ports and the interface of the graph is . Action graphs may have more than one port on the left as well. For example, one might bind the free occurrence of to give the interface . Further, the unsharing that equates the term graphs in Figures 1(a) and 1(b) is not automatic in action graphs. Rather the particular specification determines which nodes may be shared and which 1 Supported by an EPSRC Advanced Research Fellowship, email: 2 Supported by the Michael and Morven Heller Research Fellowship at Saint Catharine’s College, phone: +44 1223 334688, email: