The Interpreter Design Pattern allows you to build the rules as classes. This design pattern is very powerful in building the rules in a very logical manner. Most of the examples you see uses a programming language grammar as the rules because it's the easiest to demonstrate. However, once you realize the essence of the interpreter pattern you will see that you can apply the rules to any streams of inputs or objects.

The easiest way to understand how the interpreter pattern works is by looking at an example that will lead us to the UML of the interpreter pattern.