Incremental Attribute Evaluation for Multi-User Semantics-Based Editors

Total Page:16

File Type:pdf, Size:1020Kb

Incremental Attribute Evaluation for Multi-User Semantics-Based Editors Incremental Attribute Evaluation for Multi-User Semantics-Based Editors Josephine Micallef Columbia University Department of Computer Science New York, NY 10027 May 1991 CUCS-023-91 Incremental Attribute Evaluation for Multi-User Semantics-Based Editors Josephine Micallef Submitted in panial fulfillment of the requirements for the degree of Doctor of Philosophy in the Graduate School of Arts and Sciences. Columbia University 1991 Copyright © 1991 Josephine Micallef ALL RIGHTS RESERVED Abstract Incremental Attribute Evaluation for Multi-User Semantics-Based Editors Josephine Micallef This thesis addresses two fundamental problems associated with perfonning incremental attribute evaluation in multi-user editors based on the attribute grammar formalism: (1) multiple asynchronous modifications of the attributed derivation tree, and (2) segmentation of the tree into separate modular units. Solutions to these problems make it possible to construct semantics-based editors for use by teams of programmers developing or maintaining large software systems. Multi-user semantics­ based editors improve software productivity by reducing communication costs and snafus. The objectives of an incremental attribute evaluation algorithm for multiple asynchronous changes are that (a) all attributes of the derivation tree have correct values when evaluation terminates, and (b) the cost of evaluating attributes necessary to reestablish a correctly attributed derivation tree is minimized. We present a family of algorithms that differ in how they balance the tradeoff between algorithm efficiency and expressiveness of the attribute grammar. This is important because multi-user editors seem a practical basis for many areas of computer-supported cooperative work, not just programming. Different application areas may have distinct definitions of efficiency, and may impose different requirements on the expressiveness of the attribute grammar. The characteristics of the application domain can then be used to select the most efficient strategy for each particular editor. To address the second problem, we define an extension of classical attribute grammars that allows the specification of interface consistency checking for programs composed of many modules. Classical attribute grammars can specify the static semantics of monolithic programs or modules, but not inter-module semantics; the latter was done in the past using ad hoc techniques. Extended attribute grammars support programming- in-the-Iarge constructs found in real prograrrurung languages, including textual inclusion, multiple kinds of modular units and nested modular units. We discuss attribute evaluation in the context of prograrnrning-in-the-Iarge, particularly the separation of concerns between the local evaluator for each modular unit and the global evaluator that propagates attribute flows across module boundaries. The result is a unifOIUl approach to formal specification of both intra-module and inter-module static semantic properties, with the ability to use attribute evaluation algorithms to carry out a complete static semantic analysis of a multi-module program. Table of Contents 1. Introduction 1 1.1. Motivation 1 1.2. Thesis Problem 2 1.3. Application Scenarios 3 1.3.1. Smod 3 1.3.2. Calendar 7 1.4. Overview of Technical Results 12 1.4.1. Multiple Asynchronous Modifications 12 1.4.2. Segmentation of Derivation Tree 17 1.5. Related Work 19 1.6. Organization of Thesis 22 2. Background 24 2.1. Attribute Grammars 24 2.2. Incremental Attribute Evaluation 29 3. Incremental Attribute Evaluation for Multiple Asynchronous 36 Subtree Replacements 3.1. Problem Formulation 37 3.2. A Naive Algorithm for Multiple Updates 38 3.3. Collision-Merging Algorithm for Multiple Updates 39 3.4. Terminology 42 3.5. Multiple Cursors and Characteristic Graphs 44 3.5.1. Effect of Cursor Moyement on Characteristic Graphs 4S 3.5.2. Updating Characteristic Graphs after Subtree Replacement 48 3.6. Detecting Collisions 53 3.7. Merging Colliding Models 55 3.7.1. Merging Models after Expansion Collision 62 3.7.2. Merging Models after Initialization Collision 6S 3.8. Analysis of Collision-Merging Algorithm 68 3.9. Related Work 70 4. Static Evaluators for Incremental Attribute Evaluation of 73 Multiple Subtree Replacements 4.1. Overview of Static Evaluators 7S 4.1.1. Non-Incremental Driver for Static Evaluator 77 4.1.2. Incremental Driver for Static Evaluator 79 4.2. Static Incremental Evaluator for Multiple Asynchronous 81 Subtree Replacements 4.2.1. Determining Relative Order Among Plan Instructions 89 4.2.2. Analysis of Multiple Subtree Replacement Static Evaluator 90 4.2.3. Improvements 91 4.3. Pairwise Ordered Attribute Grammars 94 4.3.1. Algorithm to Compute Plans for POAGs 94 4.3.2. Computation of Relative Order Among Plans 97 4.4. Related Work 100 5. Extending Attribute Grammars to Support Static Semantic 102 Analysis for Programming-in-the-Large 5.1. Introduction 102 5.2. Segmentable Context-Free Grammars 106 5.2.1. Example 1: Ada 107 5.2.2. Example 2: C 109 5.2.3. Example 3: Pascal 109 5.3. Transforming the Segment Organization of a Program 112 5.3.1. List Segment Transformation 112 5.3.2. Optional Segment Transformation 11S 6. Segmentable Attribute Grammars 118 6.1. Attribute Evaluation for Segmented Derivation Trees 122 6.2. Segment Linkage 124 6.2.1. Constraints on Segment Linkage Attributes 126 6.2.2. Built-in Operators Related to Segment Linkage 129 6.3. Representation and Attribute Evaluation of Shared Segments 131 6.4. Conglomerate Attributes 136 6.4.1. Definition of Conglomerate Attributes 137 6.4.2. Selective Propagation 139 6.4.2.1. Updating a Segment's Uses Set 141 6.4.2.2. Change to Component's Used-by Set 143 6.4.2.3. Propagation after Change to Conglomerate Attribute 144 6.4.3. The isUnique Operator 146 7. Summarizable Attribute Grammars 149 7.1. Transformation involving Direct Dependencies 151 7.1.1. Case 1: Direct Dependency from an Inherited to a Synthesized IS4 Attribute. 7.1.2. Case 2: Direct dependency from a synthesized to an inherited ISS attribute. 7.2. Transformation involving Transitive Dependencies 156 7.2.1. Removing Transitive Dependency from an Inherited to a 159 Synthesized Attribute 7.2.2. Removing Transitive Dependency for AG with Nested 161 Segments 7.3. Related Work 162 8. Conclusion 166 ii 8.1. Contributions 166 8.2. Future Work 167 Bibliography 170 Appendix A. The MERCURY System 178 A.t. Overview 178 A.2. The Editor Generator 179 A.3. Run-Time Support: The Attribute Propagation Layer 180 A.4. Kernel Algorithms 183 A.5. Conclusion 185 Appendix B. Attribute Grammar for Distributed Calendar 186 Application iii List of Figures Figure 1-1: Two Smod modules before Interface Change 4 Figure 1-2: Two Smod modules after Interface Change 6 Figure 1-3: Two Calendar Schedules before Meeting Request 8 Figure 1-4: Two Calendar Schedules after Meeting Request 9 Figure 1-5: Two Calendar Schedules after Original User Confirms 10 Figure 1-6: Two Calendar Schedules after Other User Confirms 11 Figure 2-1: An Attribute Grammar Example 26 Figure 2-2: A String Derivedfrom the Grammar of Figure 2-1 28 Figure 2-3: Reps' Incremental Attribute Evaluation Algorithm 33 Figure 2-4: Expanding a Model 34 Figure 3-1: Startup Algorithm 40 Figure 3-2: Propagate Algorithm for Asynchronous Subtree 41 Replacements Figure 3-3: Characteristic Graphs Requiredfor Multiple Editing 45 Cursors Figure 3-4: Reestablishing Prepared for Propagation Invariantfor 49 Multiple Cursors Figure 3-5: Changing Transitive Dependencies 50 Figure 3-6: Algorithm to Update Incorrect Characteristic Graphs 51 Figure 3-7: Characteristic Graph Update (cont.) 52 Figure 3-8: Scenario for Collisions during Model Expansion 54 Figure 3-9: Algorithm to Expand Model and Detect Collisions 56 Figure 3-10: Clearing in-model Field when Evaluation Process 57 Terminates Figure 3-11: A Downward Collision due to a Downward Expansion 57 Figure 3-12: Search for Attributes to be Reinserted into a Colliding 59 Model Figure 3-13: Antifreeze Algorithm 62 Figure 3-14: Algorithm to Expand Model, Detect Collisions, and 63 Merge Models Figure 3-15: Replace Subtree Operation 66 Figure 3-16: Startup Algorithm (revisited) 67 Figure 4-1: Non-Incremental Driver 78 Figure 4-2: Incremental Driver 80 Figure 4-3: StartUp Algorithm 84 IV Figure 4-4: Schedule Algorithm 85 Figure 4-5: Evaluate Algorithm 86 Figure 4-6: Algorithm to Check if a Pending Evaluation has been 87 Reached Figure 4-7: Regions of the Computation Sequence 87 Figure 4-8: Attribute Grammar that is not Pairwise Ordered 92 Figure 4-9: Attribution Algorithms for Attribute Grammar of 93 Figure 4-8 Figure 4-10: Two Semantic Trees 93 Figure 4-11: Algorithm to Compute TDP 96 Figure 4-12: Algorithm to Compute ANCESTOR Relation 98 Figure 4-13: Computation of MapVisitParentToPlanlndex 99 Figure 5-1: Segmented Derivation Tree 103 Figure 5-2: Segmented Attribute Evaluation 105 Figure 5-3: Extended CFGfor Definition and Interconnection of 107 Segments in Ada Figure 5-4: Extended CFG for Definition and Interconnection of 109 Segments in C Figure 5-5: Extended CFG for Definition and Interconnection of 110 Segments in Pascal Figure 5-6: Other Segmentation Structures for Pascal 111 Figure 5-7: Transformation of Segment Organization of a Program 113 Figure 6-1: Specification of a Simple Modular Language 121 Figure 6-2: Attribute Grammar for Matching Segments in Ada 125 Figure 6-3: A Noncircular Attribute Grammar 128 Figure 6-4: Dependency Graphs of Trees Derivedfrom AG of 129 Figure 6-3 Figure 6-5: Checking for Duplicate
Recommended publications
  • Advanced Slicing of Sequential and Concurrent Programs Jens Krinke
    Advanced Slicing of Sequential and Concurrent Programs Jens Krinke April 2003 Dissertation zur Erlangung des Doktorgrades in den Naturwissenschaften ii Acknowledgments First of all, I wish to thank my adviser Gregor Snelting for providing the sup- port, freedom and protection to do research without pressure. A big ‘sorry’ goes to him, to the second reviewer, Tim Teitelbaum, and to David Melski, be- cause this thesis has become longer than expected—thanks for reading it and the valuable comments. Without the love and support of Uta von Holten, this work would not have been possible. She always believed in me, although this thesis took too long to finish. I thank my parents for enabling my career. A big ‘thank you’ goes to my students who helped a lot by implement- ing parts of the presented techniques. First of all the former students at TU Braunschweig: Frank Ehrich, who implemented the user interface of the VAL- SOFT system (14.1.6) including the graphical visualization of program depen- dence graphs, slices and chops (9.1), Christian Bruns implemented the constant propagation (11.2.2), Torsten Königshagen implemented the call graph con- struction (11.2.1), Stefan Konst implemented the approximate dynamic slicing (14.1.8), and Carsten Schulz implemented the common subexpression elimina- tion (11.2.3). Students from Universität Passau were: Silvia Breu implemented the chop visualization (10.4), Daniel Gmach implemented the textual visual- ization of slices (9.2) and duplicated code (12.2.2), Alexander Wrobel imple- mented the distance-limited slicing (10.1), and Thomas Zimmermann imple- mented some chopping algorithms (10.2).
    [Show full text]
  • Workshop on the Evaluation of Software Defect Detection Tools
    Workshop on the Evaluation of Software Defect Detection Tools Sunday, June 12th, 2005 Co-located with PLDI 2005 Workshop co-chairs: William Pugh (University of Maryland) and Jim Larus (Microsoft Research) Program chair: Dawson Engler (Stanford University) Program Committee: Andy Chou, Manuvir Das, Michael Ernst, Cormac Flanagan, Dan Grossman, Jonathan Pincus, Andreas Zeller Time What Time What 8:30 am Discussion on Soundness 2:30 pm break 2:45 pm Research presentations The Soundness of Bugs is What Matters, Patrice Godefroid, Bell Laboratories, Lucent Technologies Experience from Developing the Dialyzer: A Static Soundness and its Role in Bug Detection Systems, Analysis Tool Detecting Defects in Erlang Yichen Xie, Mayur Naik, Brian Hackett, Alex Applications, Kostis Sagonas, Uppsala University Aiken, Stanford University Soundness by Static Analysis and False-alarm Removal by Statistical Analysis: Our Airac 9:15 am break Experience, Yungbum Jung, Jaehwang Kim, Jaeho 9:30 am Research presentations Sin, Kwangkeun Yi, Seoul National University Locating Matching Method Calls by Mining 3:45 pm break Revision History Data, Benjamin Livshits, 4:00 pm Discussion of Benchmarking Thomas Zimmermann, Stanford University Evaluating a Lightweight Defect Localization Dynamic Buffer Overflow Detection, Michael Tool, Valentin Dallmeier, Christian Lindig, Zhivich, Tim Leek, Richard Lippmann, MIT Andreas Zeller, Saarland University Lincoln Laboratory Using a Diagnostic Corpus of C Programs to 10:30 am break Evaluate Buffer Overflow Detection by Static 10:45 am Invited talk on Deployment and Adoption, Manuvir Das, Analysis Tools, Kendra Kratkiewicz, Richard Microsoft Lippmann, MIT Lincoln Laboratory 11:15 am Discussion of Deployment and Adoption BugBench: A Benchmark for Evaluating Bug Detection Tools, Shan Lu, Zhenmin Li, Feng Qin, The Open Source Proving Grounds, Ben Liblit, Lin Tan, Pin Zhou, Yuanyuan Zhou, UIUC University of Wisconsin-Madison Benchmarking Bug Detection Tools.
    [Show full text]
  • Self-Adjusting Computation with Delta ML
    Self-Adjusting Computation with Delta ML Umut A. Acar1 and Ruy Ley-Wild2 1 Toyota Technological Institute Chicago, IL, USA [email protected] 2 Carnegie Mellon University Pittsburgh, PA, USA [email protected] Abstract. In self-adjusting computation, programs respond automati- cally and efficiently to modifications to their data by tracking the dy- namic data dependences of the computation and incrementally updating the output as needed. In this tutorial, we describe the self-adjusting- computation model and present the language ∆ML (Delta ML) for writ- ing self-adjusting programs. 1 Introduction Since the early years of computer science, researchers realized that many uses of computer applications are incremental by nature. We start an application with some initial input to obtain some initial output. We then observe the output, make some small modifications to the input and re-compute the output. We often repeat this process of modifying the input incrementally and re-computing the output. In many applications, incremental modifications to the input cause only incremental modifications to the output, raising the question of whether it would be possible to update the output faster than recomputing from scratch. Examples of this phenomena abound. For example, applications that interact with or model the physical world (e.g., robots, traffic control systems, schedul- ing systems) observe the world evolve slowly over time and must respond to those changes efficiently. Similarly in applications that interact with the user, application-data changes incrementally over time as a result of user commands. For example, in software development, the compiler is invoked repeatedly after the user makes small changes to the program code.
    [Show full text]
  • Ph.D Thesis: WYSINWYX What You See Is Not What You Execute
    WYSINWYX: WHAT YOU SEE IS NOT WHAT YOU EXECUTE by Gogul Balakrishnan A dissertation submitted in partial fulfillment of the requirements for the degree of Doctor of Philosophy (Computer Sciences Department) at the UNIVERSITY OF WISCONSIN–MADISON 2007 c Copyright by Gogul Balakrishnan 2007 All Rights Reserved i To my beloved grandma Rajakrishnammal::: ii ACKNOWLEDGMENTS First of all, I would like to thank my parents Mr. Balakrishnan and Mrs. Manickam for making my education a priority even in the most trying circumstances. Without their love and constant support, it would not have been possible for me to obtain my Ph.D. Next, I would like to thank my advisor, Prof. Thomas Reps, who, without an iota of exagger- ation, was like a father to me in the US. He taught me the importance of working from the basics and the need for clarity in thinking. I have learnt a lot of things from him outside work: writing, sailing, safety on the road, and so on; the list is endless. He was a source of constant support and inspiration. He usually goes out of his way to help his students—he was with me the whole night when we submitted our first paper! I don’t think my accomplishments would have been possible without his constant support. Most of what I am as a researcher is due to him. Thank you, Tom. I would also like to thank GrammaTech, Inc. for providing the basic infrastructure for CodeSurfer/x86. I am really grateful to Prof. Tim Teitelbaum for allocating the funds and the time at GrammaTech to support our group at the University of Wisconsin.
    [Show full text]
  • Adaptive Functional Programming∗
    Adaptive Functional Programming∗ Umut A. Acar† Guy E. Blelloch‡ Robert Harper§ May 5, 2006 Abstract We present techniques for incremental computing by introducing adaptive functional pro- gramming. As an adaptive program executes, the underlying system represents the data and control dependences in the execution in the form of a dynamic dependence graph. When the input to the program changes, a change propagation algorithm updates the output and the dynamic dependence graph by propagating changes through the graph and re-executing code where necessary. Adaptive programs adapt their output to any change in the input, small or large. We show that adaptivity techniques are practical by giving an efficient implementation as a small ML library. The library consists of three operations for making a program adaptive, plus two operations for making changes to the input and adapting the output to these changes. We give a general bound on the time it takes to adapt the output, and based on this, show that an adaptive Quicksort adapts its output in logarithmic time when its input is extended by one key. To show the safety and correctness of the mechanism we give a formal definition of AFL, a call-by-value functional language extended with adaptivity primitives. The modal type system of AFL enforces correct usage of the adaptivity mechanism, which can only be checked at run time in the ML library. Based on the AFL dynamic semantics, we formalize the change-propagation algorithm and prove its correctness. 1 Introduction Incremental computation concerns maintaining the input-output relationship of a program as the input of a program undergoes changes.
    [Show full text]
  • Secure Programs Via Game-Based Synthesis
    Secure Programs via Game-based Synthesis Somesh Jha Tom Reps Bill Harris University of Wisconsin (Madison) ABSTRACT Several recent operating systems provide system calls that allow an application to explicitly manage the privileges of modules with which the application interacts. Such privilege-aware operating systems allow a programmer to a write a program that satisfies a strong security policy, even when the program interacts with untrusted modules. However, it is often non-trivial to rewrite a program to correctly use the system calls to satisfy a high-level security policy. This paper concerns the policy-weaving problem, which is to take as input a program, a desired high-level policy for the program, and a description of how system calls affect privilege, and automatically rewrite the program to invoke the system calls so that it satisfies the policy. We describe a reduction from the policy-weaving problem to finding a winning strategy to a two-player safety game. We then describe a policy-weaver generator that implements the reduction and a novel game-solving algorithm, and present an experimental evaluation of the generator applied to a model of the Capsicum capability system. We conclude by outlining ongoing work in applying the generator to a model of the HiStar decentralized-information-flow control (DIFC) system. SHORT BIOGRAPHIES Somesh Jha received his B.Tech from Indian Institute of Technology, New Delhi in Electrical Engineering. He received his Ph.D. in Computer Science from Carnegie Mellon University in 1996. Currently, Somesh Jha is a Professor in the Computer Sciences Department at the University of Wisconsin (Madison), which he joined in 2000.
    [Show full text]