关系解析:一个干净,快速的解析策略,适用于所有上下文无关的语言
Relational parsing: a clean, fast parsing strategy for all context-free languages
摘要:
我们提出了一种新的分析算法的所有上下文无关的语言,计算配置之间的关系,并达到在递归转换网络的过渡。解析复杂度w.r.t.输入长度与现有技术相匹配:它是最坏情况下的三次,对于明确的文法是二次,对于LR正则文法是线性的。我们的算法的区别在于其简洁的数学公式:解析被表示为对语言和关系的简单操作的组合,因此只能使用不可变的数据结构来实现。通过正确选择这些结构,可以记住在解析典型程序设计语言期间执行的绝大多数操作,这使得我们的概念验证实现优于常见的广义解析算法,在某些情况下是几个数量级。
英文摘要:
We present a novel parsing algorithm for all context-free languages, based on computing the relation between configurations and reaching transitions in a recursive transition network. Parsing complexity w.r.t. input length matches the state of the art: it is worst-case cubic, quadratic for unambiguous grammars, and linear for LR-regular ones. What distinguishes our algorithm is its clean mathematical formulation: parsing is expressed as a composition of simple operations on languages and relations, and can therefore be implemented using only immutable data structures. With a proper choice of these structures, a vast majority of operations performed during parsing typical programming languages can be memoized, which allows our proof-of-concept implementation to outperform common generalized parsing algorithms, in some cases by orders of magnitude.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。