The Interpreter pattern interprets a language to define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
The following diagram illustrates the Interpreter pattern.
The following lists the benefits of using the Interpreter pattern:
- Easy to change and extend the grammar
- Implementing the grammar is easy