Programming by example (PBE) is an emerging programming paradigm that automatically synthesizes programs specified by user-provided input-output examples. Despite the convenience for end-users, implementing PBE tools often requires strong expertise in programming language and synthesis algorithms. Such a level of knowledge is uncommon among software developers. It greatly limits the broad adoption of PBE by the industry. To facilitate the adoption of PBE techniques, we propose a PBE framework called Bee, which leverages an "entity-action" model based on relational tables to ease PBE development for a wide but restrained range of domains. Implementing PBE tools with Bee only requires adapting domain-specific data entities and user actions to tables, with no need to design a domain-specific language or an efficient synthesis algorithm. The synthesis algorithm of Bee exploits bidirectional searching and constraint-solving techniques to address the challenge of value computation nested in table transformation. We evaluated Bee's effectiveness on 64 PBE tasks from three different domains and usability with a human study of 12 participants. Evaluation results show that Bee is easier to learn and use than the state-of-the-art PBE framework, and the bidirectional algorithm achieves comparable performance to domain-specifically optimized synthesizers.
翻译:以示例编程(PBE)是一种新兴的编程范式,能够自动合成由用户提供的输入-输出示例所指定的程序。尽管对最终用户而言十分便捷,但实现PBE工具通常需要深厚的编程语言与合成算法专业知识。这类知识在软件开发人员中并不常见,极大地限制了PBE技术在工业界的广泛采用。为促进PBE技术的普及,我们提出名为Bee的PBE框架,该框架采用基于关系表的“实体-动作”模型,在广泛且受限的领域范围内简化PBE开发。使用Bee实现PBE工具仅需将领域特定的数据实体与用户操作适配至关系表,无需设计领域特定语言或高效的合成算法。Bee的合成算法利用双向搜索与约束求解技术,应对嵌套在表转换中的值计算挑战。我们通过三个不同领域的64项PBE任务评估了Bee的有效性,并开展12名参与者的人类行为研究评估其易用性。评估结果显示,Bee相较于现有最先进的PBE框架更易学易用,其双向算法在性能上可与领域优化的特定合成器相媲美。