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框架更易学易用,其双向算法在性能上可媲美领域特化的优化合成器。