Interpreters Made Easy
The Interpreter pattern from the “Design Patterns: Elements of Reusable Object Oriented Software” can potentially be a very powerful pattern. It allows you to use a domain specific language to represent a complex computational situation. However, writing interpreters in practice can be tricky and time consuming. It really helps to know something about some fundamental parsing algorithms and techniques. The most naive approach to writing an interpret involves manually matching each possible next phrase and creating an if else soup to match each possible outcome....