Combinator Parsing: A Short Tutorial

Combinator Parsing: A Short Tutorial
复制标题

组合器解析:简短教程

DOI:
--
复制
发表时间:
2009
期刊:
LerNet ALFA Summer School
影响因子:
--
通讯作者:
S. D. Swierstra
S. D. Swierstra
中科院分区:
--
文献类型:
--
作者:
S. D. Swierstra

文献摘要

被引文献

相似文献

有许多方法可以实现给定语法的解析器;使用解析器组合子是一种强大的解析方法,它的大部分功能和表达能力都来自宿主编程语言的类型系统和语义。本教程从构建一个解析组合子的小型库开始。这个库介绍了组合子解析的基础知识,并且更一般地说明了特定于领域的嵌入式语言如何能够利用宿主语言的功能。在构造了我们的小型组合子库之后,我们研究了第一部分中介绍的朴素实现的一些缺点,并逐步开发一个没有这些问题的实现。最后,我们讨论了该库的一些进一步扩展,并将我们的方法与类似的库进行了比较。
There are numerous ways to implement a parser for a given syntax; using parser combinators is a powerful approach to parsing which derives much of its power and expressiveness from the type system and semantics of the host programming language. This tutorial begins with the construction of a small library of parsing combinators. This library introduces the basics of combinator parsing and, more generally, demonstrates how domain specific embedded languages are able to leverage the facilities of the host language. After having constructed our small combinator library, we investigate some shortcomings of the naive implementation introduced in the first part, and incrementally develop an implementation without these problems. Finally we discuss some further extensions of the presented library and compare our approach with similar libraries.