MATHEMATICAL ENGINEERING TECHNICAL REPORTS Type Specialization for Effective Bidirectionalization
Kazutaka Matsuda,Zhenjiang Hu,Masato Takeichi
2008-01-01
Abstract:A bidirectional transformation is a pair of transformations, a forward transformation and a backward transformation, where a forward transformation maps one data structure called source to another called view, and a corresponding backward transformation reflects changes on the view to the source. Its practical applications include replicated data synchronization, presentation-oriented editor development, tracing software development, and document format conversion. It is, however, difficult to develop bidirectional transformations, because the forward and backward mappings must satisfy the bidirectional properties for consistency. It is even more difficult if we want to obtain “better” bidirectional transformations with, for example, clearer consistent semantics between sources and views and more updates on views. To resolve this problem, a program transformation named bidirectionalization is proposed, in which a useful backward transformation can be derived automatically from a given forward transformation based on derivation of a complementary function. However, the language there for describing forward transformations is still too restrictive to write many practical transformations. In this paper, we relax the restrictions on the previous language by supporting forest concatenation and look-ahead mechanism specified by regular expression types, which allows us to write practical transformations. In the language, a program transformation named type specialization not only enables us to obtain “better” backward transformations but also provides exact type checking of transformations. Our new approach has been implemented, and the experimental results show our approach is promising.