一句话:提出确定性黑盒 CFG 推断方法 TreeVada:按嵌套规则预结构化输入并递归应用学习规则,速度更快、文法质量更高。
黑盒上下文无关文法推断在仅有少量示例程序的实用场景中十分困难。现有最优方法 Arvada 从扁平的解析树出发启发式地泛化文法规则,并以非确定性的方式探索不同的泛化顺序,效率与效果均受限。作者观察到 Arvada 的许多泛化步骤违背了常见的语言概念嵌套规律,据此提出先按嵌套规则对输入程序进行预结构化,再递归地应用已学到的规则,从而把黑盒文法推断变为确定性过程,形成工具 TreeVada。实证比较表明,相较于 Arvada,TreeVada 运行时间更短、推断出的文法质量更高。其源码、脚本、评估参数与训练数据均已开源公开。
Black-box context-free grammar inference is a hard problem as in many practical settings it only has access to a limited number of example programs. The state-of-the-art approach Arvada heuristically generalizes grammar rules starting from flat parse trees and is non-deterministic to explore different generalization sequences. We observe that many of Arvada's generalization steps violate common language concept nesting rules. We thus propose to pre-structure input programs along these nesting rules, apply learnt rules recursively, and make black-box context-free grammar inference deterministic. The resulting TreeVada yielded faster runtime and higher-quality grammars in an empirical comparison. The TreeVada source code, scripts, evaluation parameters, and training data are open-source and publicly available (https://doi.org/10.6084/m9.figshare.23907738).