解释器模式:OOP versus Functional Decomposition
解释器模式
In computer programming, the interpreter pattern is a design pattern that specifies how to evaluate sentences in a language. The basic idea is to have a class for each symbol (terminal or nonterminal) in a specialized computer language. The syntax tree of a sentence in the language is an instance of the composite pattern and is used to evaluate (interpret) the sentence for a client.
以上是wiki对解释器模式的描述。
这是一个学术性稍强的模式,不太好找到生活化的比喻。
就直接上代码吧。



