skip to main content
10.1145/1328438.1328487acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

Boomerang: resourceful lenses for string data

Published: 07 January 2008 Publication History

Abstract

A lens is a bidirectional program. When read from left toright, it denotes an ordinary function that maps inputs to outputs. When read from right to left, it denotes an ''update translator'' that takes an input together with an updated output and produces a new input that reflects the update. Many variants of this idea have been explored in the literature, but none deal fully with ordered data. If, for example, an update changes the order of a list in theoutput, the items in the output list and the chunks of the input that generated them can be misaligned, leading to lost or corrupted data.
We attack this problem in the context of bidirectional transformations over strings, the primordial ordered data type. We first propose a collection of bidirectional string lens combinators, based on familiar operations on regular transducers (union, concatenation, Kleene-star) and with a type system based on regular expressions. We then design anew semantic space of dictionary lenses, enriching the lenses of Foster et al. (2007) with support for two additional combinators for marking ''reorderable chunks'' andtheir keys. To demonstrate the effectiveness of these primitives, we describe the design and implementation of Boomerang, a full-blown bidirectional programming language with dictionary lenses at its core. We have used Boomerang to build transformers for complex real-world data format sincluding the SwissProt genomic database.
We formalize the essential property of resourcefulness-the correct use of keys to associate chunks in the input and output-by defining a refined semantic space of quasi-oblivious lenses. Several previously studied properties of lenses turn out to have compact characterizations in this space.

References

[1]
Artem Alimarine, Sjaak Smetsers, Arjen van Weelden, Marko van Eekelen, and Rinus Plasmeijer. There and back again: Arrows for invertible programming. In ACM SIGPLAN Workshop on Haskell, pages 86--97, 2005.
[2]
François Bancilhon and Nicolas Spyratos. Update semantics of relational views. ACM Transactions on Database Systems, 6(4):557--575, December 1981.
[3]
Nick Benton. Embedded interpreters. Journal of Functional Programming, 15(4):503--542, 2005.
[4]
Jean Berstel, Dominique Perrin, and Christophe Reutenauer. Codes and Automata. 2005. Manuscript available from http://www-igm.univ-mlv.fr/~berstel/LivreCodes/.
[5]
Aaron Bohannon, Jeffrey A. Vaughan, and Benjamin C. Pierce. Relational lenses: A language for updateable views. In Principles of Database Systems (PODS), 2006. Extended version available as University of Pennsylvania technical report MS-CIS-05-27.
[6]
Aaron Bohannon, J. Nathan Foster, Benjamin C. Pierce, Alexandre Pilkiewicz, and Alan Schmitt. Boomerang: Resourceful lenses for string data. Technical Report MS-CIS-07-15, Dept. of CIS University of Pennsylvania, November 2007.
[7]
Claus Brabrand, Anders Møller, and Michael I. Schwartzbach. Dual syntax for XML languages. Information Systems, 2007. To appear. Extended abstract in Database Programming Languages (DBPL) 2005.
[8]
Janusz A. Brzozowski. Derivatives of regular expressions. Journal of the ACM, 11(4):481--494, 1964.
[9]
Peter Buneman, Sanjeev Khanna, and Wang Chiew Tan. Why and where: A characterization of data provenance. In International Conference on Database Theory (ICDT), London, UK, volume 1973 of Lecture Notes in Computer Science, pages 316--330. Springer, 2001.
[10]
Yingwei Cui and Jennifer Widom. Lineage tracing for general data warehouse transformations. VLDB Journal, 12 (1):41--58, 2003.
[11]
Robert Ennals and David Gay. Multi-language synchronization. In European Symposium on Programming (ESOP), Braga, Portugal, volume 4421 of Lecture Notes in Computer Science, pages 475--489. Springer-Verlag, 2007.
[12]
Kathleen Fisher and Robert Gruber. PADS: a domain-specific language for processing ad hoc data. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), Chicago, IL, pages 295--304, 2005.
[13]
J. Nathan Foster, Michael B. Greenwald, Christian Kirkegaard, Benjamin C. Pierce, and Alan Schmitt. Exploiting schemas in data synchronization. Journal of Computer and System Sciences, 73(4):669--689, June 2007a. Extended abstract in Database Programming Languages (DBPL) 2005.
[14]
J. Nathan Foster, Michael B. Greenwald, Jonathan T. Moore, Benjamin C. Pierce, and Alan Schmitt. Combinators for bi-directional tree transformations: A linguistic approach to the view update problem. ACM Transactions on Programming Languages and Systems, 29(3):17, May 2007b. Extended abstract in Principles of Programming Languages (POPL), 2005.
[15]
Zhenjiang Hu, Shin-Cheng Mu, and Masato Takeichi. A programmable editor for developing structured documents based on bi-directional transformations. In Partial Evaluation and Program Manipulation (PEPM), pages 178--189, 2004.
[16]
Shinya Kawanaka and Haruo Hosoya. bixid: a bidirectional transformation language for XML. In ACM SIGPLAN International Conference on Functional Programming (ICFP), Portland, Oregon, pages 201--214, 2006.
[17]
Andrew J. Kennedy. Functional pearl: Pickler combinators. Journal of Functional Programming, 14(6):727--739, 2004.
[18]
Lambert Meertens. Designing constraint maintainers for user interaction, 1998. Manuscript.
[19]
Shin-Cheng Mu, Zhenjiang Hu, and Masato Takeichi. An algebraic approach to bi-directional updating. In ASIAN Symposium on Programming Languages and Systems (APLAS), pages 2--20, November 2004.
[20]
Benjamin C. Pierce et al. Harmony: A synchronization framework for heterogeneous tree-structured data, 2006. http://www.seas.upenn.edu/~harmony/.
[21]
M. O. Rabin and D. Scott. Finite automata and their decision problems. IBM Journal of Research and Development, 3(2):114--125, 1959.
[22]
Norman Ramsey. Embedding an interpreted language using higher-order functions and types. In ACM SIGPLAN Workshop on Interpreters, Virtual Machines and Emulators (IVME), San Diego, CA, pages 6--14, 2003.
[23]
Emmanuel Roche and Yves Schabes, editors. Finite-State Language Processing. MIT Press, 1996.
[24]
Perdita Stevens. Bidirectional model transformations in QVT: Semantic issues and open questions. In International Conference on Model Driven Engineering Languages and Systems (MoDELS), Nashville, TN, volume 4735 of Lecture Notes in Computer Science, pages 1--15. Springer-Verlag, 2007.
[25]
Naoshi Tabuchi, Eijiro Sumii, and Akinori Yonezawa. Regular expression types for strings in a text processing language. In Workshop on Types in Programming (TIP), Dagstuhl, Germany, volume 75 of Electronic Notes in Theoretical Computer Science, pages 95--113, 2002.

Cited By

View all
  • (2025)Unifying Compositional Verification and Certified Compilation with a Three-Dimensional Refinement AlgebraProceedings of the ACM on Programming Languages10.1145/37049009:POPL(1903-1933)Online publication date: 9-Jan-2025
  • (2025)Characterizations of Partial Well-Behaved LensesProceedings of the 2025 ACM SIGPLAN International Workshop on Partial Evaluation and Program Manipulation10.1145/3704253.3706139(43-53)Online publication date: 10-Jan-2025
  • (2024)Towards Formalizing and Relating Different Notions of Consistency in Cyber-Physical Systems EngineeringProceedings of the ACM/IEEE 27th International Conference on Model Driven Engineering Languages and Systems10.1145/3652620.3688565(915-919)Online publication date: 22-Sep-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
POPL '08: Proceedings of the 35th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
January 2008
448 pages
ISBN:9781595936899
DOI:10.1145/1328438
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 43, Issue 1
    POPL '08
    January 2008
    420 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/1328897
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 07 January 2008

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. bidirectional languages
  2. lenses
  3. regular string transducers
  4. regular types
  5. view update problem

Qualifiers

  • Research-article

Conference

POPL08

Acceptance Rates

Overall Acceptance Rate 860 of 4,328 submissions, 20%

Upcoming Conference

POPL '26

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)25
  • Downloads (Last 6 weeks)2
Reflects downloads up to 07 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2025)Unifying Compositional Verification and Certified Compilation with a Three-Dimensional Refinement AlgebraProceedings of the ACM on Programming Languages10.1145/37049009:POPL(1903-1933)Online publication date: 9-Jan-2025
  • (2025)Characterizations of Partial Well-Behaved LensesProceedings of the 2025 ACM SIGPLAN International Workshop on Partial Evaluation and Program Manipulation10.1145/3704253.3706139(43-53)Online publication date: 10-Jan-2025
  • (2024)Towards Formalizing and Relating Different Notions of Consistency in Cyber-Physical Systems EngineeringProceedings of the ACM/IEEE 27th International Conference on Model Driven Engineering Languages and Systems10.1145/3652620.3688565(915-919)Online publication date: 22-Sep-2024
  • (2024)Formal Foundations of Consistency in Model-Driven DevelopmentLeveraging Applications of Formal Methods, Verification and Validation. Specification and Verification10.1007/978-3-031-75380-0_11(178-200)Online publication date: 27-Oct-2024
  • (2023)Bidirectional Object-Oriented Programming: Towards Programmatic and Direct Manipulation of ObjectsProceedings of the ACM on Programming Languages10.1145/35860357:OOPSLA1(230-255)Online publication date: 6-Apr-2023
  • (2023)Contract lenses: Reasoning about bidirectional programs via calculationJournal of Functional Programming10.1017/S095679682300005933Online publication date: 6-Nov-2023
  • (2023)Ghost key distribution under mutual authentication mechanismInformation Sciences: an International Journal10.1016/j.ins.2023.119025640:COnline publication date: 11-Jul-2023
  • (2022)Tower: data structures in Quantum superpositionProceedings of the ACM on Programming Languages10.1145/35632976:OOPSLA2(259-288)Online publication date: 31-Oct-2022
  • (2022)Aeneas: Rust verification by functional translationProceedings of the ACM on Programming Languages10.1145/35476476:ICFP(711-741)Online publication date: 31-Aug-2022
  • (2022)Synbit: synthesizing bidirectional programs using unidirectional sketchesFormal Methods in System Design10.1007/s10703-023-00436-961:2-3(198-247)Online publication date: 1-Dec-2022
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media