Generic representations of tree transformations

  • Authors:
  • Jeroen Bransen;José Pedro Magalhães

  • Affiliations:
  • Utrecht University, Utrecht, Netherlands;University of Oxford, Oxford, United Kingdom

  • Venue:
  • Proceedings of the 9th ACM SIGPLAN workshop on Generic programming
  • Year:
  • 2013

Quantified Score

Hi-index 0.00

Visualization

Abstract

Applications which deal with editing of structured data over multiple iterations, such as structure editors, exercise assistants, or applications which support incremental computation, need to represent transformations between different versions of data. A general notion of "transformation" should be more informative than what is obtained by computing the difference between the old and the new term, as diff algorithms generally consider only insert, copy, and delete operations. Transformations, however, may involve swapping elements, or duplicating them, and a good representation of transformations should not involve unnecessary repetition of data, or lose shared structure between the old and new term. In this paper we take a detailed look at the notion of transformation on strongly-typed structures. Our transformations are datatype-generic, and thus can be applied to a large class of data structures. We focus on representing transformations in a way that maximally captures the common substructure between the old and new term. This is of particular importance to a specific class of applications: that of incremental computations which recompute information only for the parts of the tree that are affected by a transformation. We present three different approaches to the problem, of varying complexity, flexibility, and user-friendliness; different approaches might be better suited for one particular application area or another. We provide practical examples of how to encode transformations in each of the approaches, as well as suggestions on how to apply our solution to larger applications. All approaches use the same underlying generic programming library, and support transformations over families of mutually recursive datatypes.