当前位置: X-MOL 学术J. Comput. Lang. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Fast GLR parsers for extended BNF grammars and transition networks
Journal of Computer Languages ( IF 1.7 ) Pub Date : 2021-04-08 , DOI: 10.1016/j.cola.2021.101035
Angelo Borsotti , Luca Breveglieri , Stefano Crespi Reghizzi , Angelo Morzenti

The Tomita’s Generalized LR(1) parsing algorithm (GLR), later improved in many ways, runs in a linear time on LR(1) grammars, and degrades to a polynomial-time bound if the grammar is not deterministic. We address a useful feature not present in the current GLR(1) methods: the ability to accept grammars of the Extended BNF type (EBNF), the rules of which contain regular expressions. An EBNF grammar is conveniently represented by a collection of finite automata called a Transition Net (TN). We define, analyze and evaluate a new GLR(1) algorithm, called GELR, that combines the recent LR(1) parsing algorithm for TNs with the classical GLR data structures: the Graph-Structured Stack representing multiple stacks, and the Shared Packed Parse Forest for multiple syntax trees. The GELR algorithm is proved correct and an efficient implementation incorporating the state-of-the-art Right-Nulled parsing optimization is available. Experimental measures of the GELR parser size, speed and memory footprint are reported for current programming and web languages, and are compared with those of other parsing algorithms. The findings prove that directly parsing EBNF grammars does not penalize speed. Performance comparisons for different computer languages should also be of interest.



中文翻译:

快速的GLR解析器,用于扩展的BNF语法和过渡网络

富田的广义 左心室1个 解析算法(GLR)(后来在很多方面进行了改进)在 左心室1个语法,如果语法不是确定性的,则降级为多项式时间范围。我们解决了当前不存在的有用功能GLR1个方法:具有接受扩展BNF类型(EBNF)语法的能力,该规则的规则包含正则表达式。EBNF语法方便地由称为过渡网(TN)的有限自动机集合表示。我们定义,分析和评估新GLR1个 称为GELR的算法,该算法结合了最新的 左心室1个具有经典GLR数据结构的TN的解析算法:表示多个堆栈的图结构堆栈,以及用于多个语法树的共享打包解析林。事实证明,GELR算法是正确的,并且可以使用结合了最新的Right-Nulled解析优化的高效实现。报告了针对当前编程和Web语言的GELR解析器大小,速度和内存占用量的实验度量,并将其与其他解析算法进行了比较。研究结果证明,直接解析EBNF语法不会影响速度。不同计算机语言的性能比较也应引起关注。

更新日期:2021-04-12
down
wechat
bug