Summary
Interpreters let you compose new commands, using the classes in a hierarchy that you create. Each class in the hierarchy defines a way of composing commands—a grammar rule. This composition rule determines how the class implements, or interprets, an operation that you distribute throughout the hierarchy.
The operation in an interpreter is often named execute() or evaluate(). The operation name is necessarily vague, becoming meaningful only when combined with the name of the class that implements it. Like STATE, STRATEGY, and COMMAND, the INTERPRETER pattern fixes the name of an operation and uses various classes to implement the operation. INTERPRETER applies this idea to let you compose executable objects according to a set of composition ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access