Staged selective parser combinators

Staged selective parser combinators
复制标题

分阶段选择性解析器组合器

DOI:
10.1145/3409002
复制
发表时间:
2020
影响因子:
--
通讯作者:
Matthew Pickering
Matthew Pickering
中科院分区:
--
文献类型:
--
作者:
Jamie Willis;Nicolas Wu;Matthew Pickering

文献摘要

参考文献

被引文献

相似文献

解析器组合子是介于手动解析器的精细控制和通过解析器生成器创建的解析器的高级几乎类似语法的外观之间的中间地带。它们还促进了解析器的更清晰的组合设计。然而,从历史上看,它们无法与同行的业绩相匹配。本文描述了如何将解析器组合子编译成具有手写质量的解析器。这是通过将语法表示为树来利用语法中存在的静态信息来完成的。然而,为了利用这些信息,有必要放弃对一元计算的支持,因为这会生成动态结构。选择性函子可以帮助恢复在没有monad的情况下丢失的功能,并且解析器树可以通过staging进行部分评估。这是在一个名为Parsley的库中实现的。
Parser combinators are a middle ground between the fine control of hand-rolled parsers and the high-level almost grammar-like appearance of parsers created via parser generators. They also promote a cleaner, compositional design for parsers. Historically, however, they cannot match the performance of their counterparts. This paper describes how to compile parser combinators into parsers of hand-written quality. This is done by leveraging the static information present in the grammar by representing it as a tree. However, in order to exploit this information, it will be necessary to drop support for monadic computation since this generates dynamic structure. Selective functors can help recover lost functionality in the absence of monads, and the parser tree can be partially evaluated with staging. This is implemented in a library called Parsley.
DOI: 10.1145/2692915.2628138
发表时间: 2014-08
影响因子: --
作者:
J. Gibbons;Nicolas Wu
通讯作者: J. Gibbons;Nicolas Wu