Hands-On Design Patterns with Java
上QQ阅读APP看书,第一时间看更新

Using the interpreter pattern

The interpreter design pattern is used to establish a grammatical representation and an interpreter that interprets language. That might sound a bit complex and, although the concept is simple, their implementation often is not. This design pattern can be used for the interpretation of interpreted programming languages or languages that are compiled in byte code or other intermediate languages such as the Microsoft Intermediate Language (MSIL).

We will look at an example use case, the UML class diagram, and the source code necessary to implement the interpreter design pattern for this scenario.