论文标题

属性语法中语义动作的综合

Synthesis of Semantic Actions in Attribute Grammars

论文作者

Kalita, Pankaj Kumar, Kumar, Miriyala Jeevan, Roy, Subhajit

论文摘要

属性语法允许语义行动与无上下文语法的生产规则相关,从而提供了一种简单而有效的形式主义来定义语言的语义。但是,起草语义动作可能很棘手,并且会大大消耗开发者时间。在这项工作中,我们提出了一种综合方法,以自动从将字符串与其含义相关联的示例中推断出语义动作。我们还提出了一个新的覆盖率指标,派生覆盖范围。我们使用它来构建一个采样器,以有效并自动绘制字符串以驱动合成引擎。我们将自己的想法纳入工具,Panini,并在十二个基准上进行经验评估,包括向前的差异引擎,Java字节码子集的解释器以及C语言的迷你编译器至两次编码。我们的结果表明,Panini随着要合成的动作数量和无上下文语法的大小而表现得很好,显着超过了简单的基线。

Attribute grammars allow the association of semantic actions to the production rules in context-free grammars, providing a simple yet effective formalism to define the semantics of a language. However, drafting the semantic actions can be tricky and a large drain on developer time. In this work, we propose a synthesis methodology to automatically infer the semantic actions from a set of examples associating strings to their meanings. We also propose a new coverage metric, derivation coverage. We use it to build a sampler to effectively and automatically draw strings to drive the synthesis engine. We build our ideas into our tool, PANINI, and empirically evaluate it on twelve benchmarks, including a forward differentiation engine, an interpreter over a subset of Java bytecode, and a mini-compiler for C language to two-address code. Our results show that PANINI scales well with the number of actions to be synthesized and the size of the context-free grammar, significantly outperforming simple baselines.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源