arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1907.08837cs.FL
收藏

带标记的确定性有限自动机

Tagged Deterministic Finite Automata with Lookahead

Ulya Trofimovich

摘要:

本文扩展了Laurikari和Kuklewicz在正则表达式子匹配提取方面对标记确定性有限自动机(TDFA)的工作。这项工作的主要目标是应用TDFA的词法分析器生成器,优化生成代码的速度。我建议对Laurikari算法进行一些实际的改进;特别是,使用一个符号的前瞻,这导致标记变量和对它们的操作的显着减少。实验结果证实,lookahead意识TDFA是相当快,通常比基线TDFA小,他们是合理的接近用于识别正则语言的普通DFA的速度和大小。该算法可以处理重复的子匹配,因此适用于全句法分析。此外,我研究了在最左边的贪婪和POSIX策略的情况下消除歧义的问题。我形式化的POSIX消歧算法建议Kuklewicz,并表明所产生的TDFA是有效的劳里卡里TDFA或TDFA使用最左边的贪婪消歧。所有讨论的算法都在开源词法分析器生成器RE 2C中实现。

英文摘要:

This paper extends the work of Laurikari and Kuklewicz on tagged deterministic finite automata (TDFA) in the context of submatch extraction in regular expressions. The main goal of this work is application of TDFA to lexer generators that optimize for speed of the generated code. I suggest a number of practical improvements to Laurikari algorithm; notably, the use of one-symbol lookahead, which results in significant reduction of tag variables and operations on them. Experimental results confirm that lookahead-aware TDFA are considerably faster and usually smaller than baseline TDFA; and they are reasonably close in speed and size to ordinary DFA used for recognition of regular languages. The proposed algorithm can handle repeated submatch and therefore is applicable to full parsing. Furthermore, I examine the problem of disambiguation in the case of leftmost greedy and POSIX policies. I formalize POSIX disambiguation algorithm suggested by Kuklewicz and show that the resulting TDFA are as efficient as Laurikari TDFA or TDFA that use leftmost greedy disambiguation. All discussed algorithms are implemented in the open source lexer generator RE2C.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑