The Interpreter pattern is a behavioral GoF design pattern by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides that, for a given language, defines a representation of its grammar together with an interpreter that uses this representation to interpret sentences in the language. It suits small grammars and domain-specific languages, where each grammar rule becomes part of the representation the interpreter evaluates.

GoF-Interpreter Pattern

Details
Full Name

GoF Interpreter Pattern (Behavioral)

Intent:

Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.