Semantic comparison of Visual Dataflow Programs Anh Dang

  • Slides: 1
Download presentation
Semantic comparison of Visual Dataflow Programs Anh Dang Phil Cox, Dalhousie University. Introduction Semantic

Semantic comparison of Visual Dataflow Programs Anh Dang Phil Cox, Dalhousie University. Introduction Semantic equivalence Alpha-beta pruning • A set of subgraph isomorphisms between two directed graphs is computed, and for each function in this set, local • Despite 25 years of continuing research, visual • Two program elements in Prograph are semantically programming languages (VPLs) have made few equivalent iff with the same inputs they will produce the inroads into the world of industrial software development. same outputs. • The semantics of controlled data flow programs, like the semantics of functional programs and unlike those of architecture of software systems, but have not imperative languages, is closely aligned with the syntax. representing algorithms. • One reason is that VPLs lack source-code analysis controlled dataflow VPLs such as Prograph. • Local differences due to an isomorphism is the sum of the 10 due to mismatched connections and extra program Cut-off Mismatched datalinks M 1 C 3 • The value of a case node can only get smaller as The comparison algorithm search proceeds. Hence a modified version of alpha- Comparing operations: beta search algorithm is used to reduce the number of The first terminals have different types, as do their second terminals, count 2 The numbers of roots is different, count 1 nodes explored in the search tree. Two operations have different controls and types, count 2 Figure 2. Counting differences between operations Extra nodes and datalinks • If at any time, the difference count of a method or isomorphism node is larger the alpha value, the algorithm does not need to explore further (cut-off). search tree in which a node is either a pair of methods • If at any time, the difference count of a case node is (M), a pair of cases (C) or an isomorphism (I), as shown in equal to zero, the algorithm does not need to explore figure 5. further (cut-off). In Figure 2, the number of differences between two operations is 5 • For a method node, its children nodes are sorted A method consists a sequence of cases Comparing cases and methods: M increasingly by case local differences to significantly C • Method local difference is the different number of cases between two methods. I M • Each case is considered as a directed acyclic graph C where the vertices are the operations, and there is an edge from operation A to operation B iff there is a M C C I M C reduce the total number of nodes searched. I • For an isomorphism node, its children nodes are sorted I M M C C Figure 5. The search tree. Input of the values of its children plus the local difference. The 1 1 <= -1 Fact. A * Output The algorithm: <= -1 • The algorithm uses depth-first search to traverse the tree, -1 Fact. A * Output Figure 3. Directed acyclic graphs for two diagrams in Figure 4. • Finds semantic differences rather than syntactic differences value of a case node is the smallest value among its child nodes. guided by heuristics based on estimates of the numbers of differences between the items being compared at each node. Determines if two programs are semantically equivalent, even if they are syntactically different. • The value of a method or an isomorphism node is the sum Input cases, each of which is a data flow diagram of Concluding remarks • Input and output bars must be matched • A method in Prograph consists of a sequence of decreasingly by method local differences. M datalink or a synchro from A to B. storage locations. Figure 1 shows a Prograph method. C 2 Figure 6. Difference search tree. cannot detect semantic differences. • To compare two methods, the algorithm traverses a operations connected by datalinks. For example, M 2 10 Figure 4. Counting differences between cases with a set of persistents, which are globally accessible I 3 elements, as shown in Figure 4. Extra synchro • In Prograph, a program is a set of methods together I 2 compared with those that are available for TPLs and • Prograph Figure 1. A method with two cases implementing the quicksort algorithm. C I 1 • Existing differencing tools for VPLs are quite primitive tools, such as differencing tools. • We present a semantic differencing algorithm for M differences between matched operations plus differences • Visual representations are used to specify the replaced textual programming languages (TPLs) for differences of an isomorphism is calculated, as follows. • Can be adapted to any controlled dataflow VPL Future work • Replace subgraph isomorphism with maximal common subgraph search • Investigate domain-specific matching algorithm for cases • Apply semantic differences to program integration and regression testing.