为了理解其中的原理,我们必须简要了解解析器组合子的实现。
To understand how this all works, we have to take a brief dive into the parser combinator implementation.
“组合”解析器可以提供解析概念的越来越高级的抽象(因此称为“解析器组合子”;组合在一起的元素提供解析行为)。
Parsers "combine" to provide higher and higher levels of abstraction over the concept of parsing (hence the name "parser combinators"; elements which combine together to provide parsing behavior).
本文到此结束。在下一篇文章中,我们将回顾scala的更多语言功能(比如泛型,因为解析器组合子是由它们组成的)。
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).
确实有另外一种方法。为了理解这种方法的工作原理,您将需要研究一下解析器组合子是如何产生非“标准”的元素的(即不是String和List)。
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).
同时,我们来探索Scala构建解析器的第3个选项:解析器组合子(parsercombinators),它完全是从Scala的函数性方面构建的。
In the meantime, let's explore Scala's third option for building parsers: parser combinators, built entirely from the functional side of Scala.
在原来的解析器中,可以接受像“5 + 5 + 5”这样的表达式,因为语法中为表达式(expr)和术语(term)定义了rep组合子。
In the original parser, expressions like "5 + 5 + 5" were acceptable owing to the rep combinator in the grammar definition for expressions (expr) and terms (term).
在原来的解析器中,可以接受像“5 + 5 + 5”这样的表达式,因为语法中为表达式(expr)和术语(term)定义了rep组合子。
In the original parser, expressions like "5 + 5 + 5" were acceptable owing to the rep combinator in the grammar definition for expressions (expr) and terms (term).
应用推荐