Interpreter Pattern

Overview

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

Participants

AbstractExpression

TerminalExpression

NonterminalExpression

Context

Client

Parameters

Interpret Method

Create Pattern Links

Applicability

Use the Interpreter pattern when there is a language to interpret, and you can represent statements in the language as abstract syntax tress. The Interpreter pattern works best when