INTERVIEWS
IV. ANALYSIS AND CONCLUSIONS
Flow raphs can be used to represent collections of components having inputs and outputs that are produced or consumed by each other. In using this representation, we would like to be able to view a flow graph in which two or more components of te same type are collapsed into a single shared component as being equivalent to a flow graph in which te two components are not collapsed. See Figure 311.
This is important in dealing with variation due to function-sharing, in engineering ap-plications of the formalism. Function-sharing is a common egineering optimization made during design, in which oe component fulfills more than one purpose. For example, in an optimized program, two or more functions may be applied to the result of a single (shared) function application.
We employ a notion of share-equivalence to capture the relationship between flow graphs, such as those in Figure 311. This notion was introduced by Lutz 90] for graphs similar to ours. Sliare-eqnivalence is defined in terms of a binary relation collapses (denoted < on flow graphs. Flow graph F collapses flow graph 2 if and only if there are two nodes nj and n2 of the same node type t in 2, having iput arity I ad output arity 0, such tat all of these conditions hold:
1. Either one or both of the following are true:
(a) Vi = ... 1, the ih iput port of nj is connected to the same set of output ports as the ih iput port of n2
(b) V = 1-0, the jth Output port of nj is connected to the same set of input ports as the jth output port of
n2-2. F can be created from 2 by replacing nj and n2 with a new node n3 of type t with.
the ih input (resp., output) of n3 connected to the uion of the ports connected to 76
(X
(X
01
a b
-OX
D--.O-C
Figure 312: a) A grammar. b) Its core language. c) Some flow graphs in its expanded language.
the ith inputs (resp., outputs) of ni and
n2-3. The attribute values of n ad n2 can be "combined." This is done by applying an attribute combination function, which is defined for each attribute, to te attribute values of nj and n2. The attribute combination functions may be partial fnctions If the unction is not defined for n and n2's attributes, then the attribute values cannot be combined (and F does not collapse 2).
For example, in Fgure 311, F collapses 2 which collapses 3. Performing the trans-formation in condition 2 from 2 to F is called "zipping up" 2. Its inverse 'is referred to as unzipping
The reflexive, symmetric, transitive closure of collapses, ,*, defines the equivalence relation share-equivalent. (In Figure 311, F, 2, and 3 are all share-equivalent.)
The directly derives relation (,) between flow graphs is redefined as follows. A flow graph F directly derives aother flow graph 2 if and only if either 2 can be produced by applying a grammar rule to F1, F <I 2, or 2 j Fl.
As in string grammars, the reflexive, transitive closure of is the derives relation The language of a flow graph grammar G (denoted L(G)) is the set of a flow graphs, wose nodes are of terminal type ad which can be derived from a start type of G.
Thus, the notion of a language of a flow graph grammar G as been extended to include 77
S
X Z
A X YX
b a C
(C)
(b)
Figure 313: a) A grammar. b A derivation sequence. c A derivation graph representing
the derivation.
flow graphs that are generated by a series of not only production rule applications but also zp--up and uzipping transformations. Since a zip-up or unzipping step can happen anywhere in the derivation sequence, the language of a graph grammar G in this extended formalism is a s-uperset of the set of flow graphs share-equivalent to flow graphs in te
44 core" language of G in the extended formalism. For example, the flow graphs in Figure 3-12c are included in the language of the grammar in Figure 3-12a, even though they are not share-equivalent to either of the flow graphs in the grammar's core language, shown in Figure 3-12b.
Both generators and parsers for the language of a flow graph grammar can interleave zipping and unzipping transformation steps with their usual expansion and reduction steps.
The parser used by tlie program recognition system ported here simulates the itroduction of these transformations into 'Its reduction sequence, as is described 'in Section 35-1.
Structure-Sharing Derivation "Trees"
The extensions to the language of a flow graph grammar affect how equivalent derivation sequences are captured in a sngle canonical tree representation. Because flow graph zip-up can occur as part of a derivation sequence and this results in a shared subderivation, the representation of a derivation as a tree is no longer possible. Derivations must be represented as graphs. For example, see Figure 313.
In addition there may be different derivation graphs, depending on when unzipping is done in the derivation sequence. For example, Figure 3-14a shows a simple flow graph
78
(X 0
"4sc-w
f-O&L-m M+
(a)
4
-- Wcc:: 4 4
4
-pec: 4 4
4 4
(b)
s
w z
0
lla
c c
I I
s
w A
0 a a I
(C)
Figure 314: (a) A grammar. (b) Two derivations of same flow graph. (c) Two derivation graphs representing the derivations.
79
grammar and Figure 3-14b gives two possible derivation sequences. In the first sequence, the -unzipping transformation happens in the second step. In the second derivation se-q-uence, this transformation happens in the third step. An unzipping step is represented in a derivation graph by a vertex that is a group of instances of that vertex, each with its own sub-derivation. Te two derivation sequences are represented by the two derivation graphs in Figure 3-14c.
We arbitrarily coose those derivation graphs as canonical that represent derivation sequences in which uzipping occurs at the earliest possible moment in the derivation se-quence (i.e., unzip a non-terminal before it is expanded). In our example, the derivation graph on te left is taken as canonical.