Monadic parser combinators

Monadic parser combinators
复制标题

Monadic 解析器组合器

DOI:
--
复制
发表时间:
1996
期刊:
影响因子:
--
通讯作者:
E. Meijer
E. Meijer
中科院分区:
--
文献类型:
--
作者:
G. Hutton;E. Meijer

文献摘要

被引文献

相似文献

在函数式编程中,构建递归下降解析器的一种流行方法是将解析器建模为函数,并定义高阶函数(或组合子)来实现语法结构,如排序,选择和重复。这样的解析器形成了monad的一个实例,monad是数学中的一种代数结构,已被证明可用于解决许多计算问题。本报告的目的是提供一个关于构建函数解析器的monadic方法的分步教程,并解释利用monad的一些好处。没有先验知识的分析器组合子或单子是假定的。事实上,这份报告也可以被视为在编程中使用monad的第一个介绍。
In functional programming, a popular approach to building recursive descent parsers is to model parsers as functions, and to define higher-order functions (or combinators) that implement grammar constructions such as sequencing, choice, and repetition. Such parsers form an instance of a monad, an algebraic structure from mathematics that has proved useful for addressing a number of computational problems. The purpose of this report is to provide a step-by-step tutorial on the monadic approach to building functional parsers, and to explain some of the benefits that result from exploiting monads. No prior knowledge of parser combinators or of monads is assumed. Indeed, this report can also be viewed as a first introduction to the use of monads in programming.