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

Yacc死了

Yacc is dead

Matthew Might, David Darais

摘要:

我们提出了两种新的方法来分析上下文无关的语言。第一种方法是基于从正则表达式到上下文无关文法的Brzozowski导数的扩展。第二种方法是基于衍生分析器组合子的推广。这些技术的回报是一个小的(少于250行代码),易于实现的解析库,能够将任意上下文无关文法解析成惰性解析森林。提供了Scala和Haskell的实现。S-Expressions的初步实验每秒解析数百万个标记,这表明这种技术在实践中足够有效。

英文摘要:

We present two novel approaches to parsing context-free languages. The first approach is based on an extension of Brzozowski's derivative from regular expressions to context-free grammars. The second approach is based on a generalization of the derivative to parser combinators. The payoff of these techniques is a small (less than 250 lines of code), easy-to-implement parsing library capable of parsing arbitrary context-free grammars into lazy parse forests. Implementations for both Scala and Haskell are provided. Preliminary experiments with S-Expressions parsed millions of tokens per second, which suggests this technique is efficient enough for use in practice.

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

↑