The interpreter pattern
The interpreter pattern is not really used, but it can be really useful. Usually, this pattern is described in terms of formal grammar but the area where it can be applied, can be extended.
You can refer to the following for more information: Lecture de chiffre Romain (http://www.oodesign.com/interpreter-pattern.html) and https://en.wikipedia.org/wiki/Roman_numerals.
Roles
The interpreter pattern defines an object representation of a language grammar in order to evaluate some expression written in this language by interpreting them.
This pattern can be used to interpret some expressions that are represented as a hierarchical tree. It may be applied when:
Grammar of expression is simple
Evaluation doesn't need to be quick
Some examples where this pattern can be used are:
In rule engines
To add some functionality to the composite pattern
Design
The implementation of this pattern is seen in the use of the composite pattern applied to represent a grammar (refer to the The composite...