Giving meaning to the context using the interpreter pattern
The interpreter pattern interprets sequences of characters into desired actions. It was identified early due to its use in SQL statement translation and described in more detail in the GoF’s book.
Motivation
The interpreter pattern defines two types of objects that refer to specific sequences of characters. They are terminal and non-terminal actions or operations that can be performed on the sequence of characters under consideration. These operations represent the computer language that is used and have their own semantics. The syntactic tree of a given sentence – a sequence of characters – is an instance of a compound pattern and is used to evaluate and interpret meaning for the client program.
Finding it in the JDK
The java.base
module contains the java.util.regex
package with the Pattern
class. This class represents the compilation of regular expressions. Specific semantics are applied...