合成双射透镜
Synthesizing Bijective Lenses
摘要:
不同数据表示之间的双向转换在现代软件系统中经常发生。它们以序列化器和反序列化器、数据库视图和视图更新器等形式出现。手动构建双向转换-通过编写两个独立的函数来实现逆转换-既繁琐又容易出错。更好的方法是使用特定于领域的语言,在这种语言中,两个方向都可以写成一个表达式。然而,这些领域特定的语言可能很难编程,需要程序员在复杂的类型系统中工作时管理繁琐的细节。为了解决这个问题,我们提出了Optician,一个用于双射字符串Transformers器类型定向合成的工具。Optician的输入是表示两种数据格式的两个普通正则表达式和一些用于消除歧义的具体示例。输出是一个用Boomerang(一种基于透镜理论的双向语言)编写的良好类型的程序。主要的技术挑战包括足够有效地导航巨大的程序搜索空间。与大多数先前的工作类型导向的合成,我们的系统运行在一个语言的背景下,具有丰富的等价关系的类型(正则表达式理论)。我们合成等价语言的术语,并将这些生成的术语转换为我们的镜头语言。我们证明了我们的合成算法的正确性。我们还表明,经验表明,我们的新语言的合成问题,承认棘手的解决方案,承认高效的解决方案之一。我们评估Optician的基准套件的39个例子,包括微基准和现实的例子来自其他数据管理系统,包括Flash Fill,一个工具,用于合成字符串转换的电子表格,Augeas,一个工具,用于双向处理Linux系统配置文件。
英文摘要:
Bidirectional transformations between different data representations occur frequently in modern software systems. They appear as serializers and deserializers, as database views and view updaters, and more. Manually building bidirectional transformations---by writing two separate functions that are intended to be inverses---is tedious and error prone. A better approach is to use a domain-specific language in which both directions can be written as a single expression. However, these domain-specific languages can be difficult to program in, requiring programmers to manage fiddly details while working in a complex type system. To solve this, we present Optician, a tool for type-directed synthesis of bijective string transformers. The inputs to Optician are two ordinary regular expressions representing two data formats and a few concrete examples for disambiguation. The output is a well-typed program in Boomerang (a bidirectional language based on the theory of lenses). The main technical challenge involves navigating the vast program search space efficiently enough. Unlike most prior work on type-directed synthesis, our system operates in the context of a language with a rich equivalence relation on types (the theory of regular expressions). We synthesize terms of a equivalent language and convert those generated terms into our lens language. We prove the correctness of our synthesis algorithm. We also demonstrate empirically that our new language changes the synthesis problem from one that admits intractable solutions to one that admits highly efficient solutions. We evaluate Optician on a benchmark suite of 39 examples including both microbenchmarks and realistic examples derived from other data management systems including Flash Fill, a tool for synthesizing string transformations in spreadsheets, and Augeas, a tool for bidirectional processing of Linux system configuration files.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。