图 15.1 模拟火星和地球围绕太阳旋转 解析器连接符(Parser combinators) 连接符库在函数式编程社区很流行,已用于许多任务。最著名的例子可能是 Parsec 库,用于创建解析器 [[Leijen, Meijer, 2001]。
基于4个网页-相关网页
In the meantime, let's explore Scala's third option for building parsers: parser combinators, built entirely from the functional side of Scala.
同时,我们来探索Scala构建解析器的第3个选项:解析器组合子(parser combinators),它完全是从Scala的函数性方面构建的。
There is, and to understand how it works, you'll need to take a short dive into how parser combinators produce non - "standard" elements (that is, not Strings and Lists).
确实有另外一种方法。为了理解这种方法的工作原理,您将需要研究一下解析器组合子是如何产生非“标准”的元素的(即不是String和List)。
That's it for now; in the next set of articles, we'll go back to visiting more of Scala's language capabilities (such as generics, because parser combinators made use of them).
本文到此结束。在下一篇文章中,我们将回顾scala的更多语言功能(比如泛型,因为解析器组合子是由它们组成的)。
应用推荐