Fact-checked by Grok 2 weeks ago

Interpreter pattern

The Interpreter pattern is a behavioral design pattern in object-oriented that defines a way to evaluate sentences in a simple language by representing its grammar as a and providing an interpreter that uses this representation to process input sentences. Introduced in the seminal 1994 book Design Patterns: Elements of Reusable Object-Oriented Software by , Richard Helm, Ralph Johnson, and Vlissides—commonly known as the (GoF) book—this pattern addresses the need to interpret domain-specific s (DSLs) or expression grammars without hardcoding every possible variation. The motivation stems from scenarios where a system's features, such as numerical expressions or rules, are well-defined but require flexible evaluation; for instance, restricting identifiers to alphanumeric characters starting with letters simplifies the grammar and enables recursive interpretation via parse trees. It is particularly suited for applications involving fixed, simple grammars, like evaluating boolean expressions or arithmetic operations, where the alternative of procedural code for each rule would become unwieldy. At its core, the pattern's structure revolves around key participants: an AbstractExpression interface or abstract class declaring an interpret method that takes a context (e.g., input string or variables); TerminalExpression concrete classes for primitive elements like literals or variables; and NonterminalExpression classes for composite rules, such as operators, which recursively invoke interpret on child expressions. A Context object often holds global information, like variable values or the input stream, to support evaluation. This setup leverages a —typically built using the —to represent the sentence, allowing the interpreter to traverse and compute results bottom-up. The pattern's applicability is limited to simple languages due to the exponential complexity of parsing more intricate grammars; for complex cases, dedicated parser generators like or are preferred over manual . Consequences include easier extension of the grammar by adding new expression types and for multiple interpretations via the , but it can lead to large class hierarchies and inefficient performance for deep without optimizations like flyweight sharing for common subexpressions. Known uses include SQL engines, rule-based systems for queries (e.g., evaluating "John is male" against a of attributes), and recursive operations on tree-structured data like expression trees for . It relates closely to the for building parse trees and the for efficiency in repeated substructures.

Overview

Intent and Motivation

The Interpreter pattern is a behavioral that specifies how to evaluate sentences in a by defining a for its along with an interpreter that uses this to interpret the sentences. It maps a domain to a , the to a , and the to a hierarchical object-oriented , enabling the evaluation of expressions in that . The pattern's motivation arises from the need to parse and interpret simple , such as mathematical expressions or configuration rules, where ad-hoc string processing or custom code becomes inefficient and hard to maintain as the language evolves. In scenarios involving repeated problems within a well-defined , characterizing the domain as a "little language" allows for an interpretation engine to solve these issues more elegantly than bespoke solutions. This approach originated in the context of object-oriented design for handling formal grammars without requiring full compiler development. The core goal of the Interpreter pattern is to represent the rules of the language grammar as an (AST), which is then traversed recursively through a to evaluate expressions. This structure facilitates the interpretation of valid sentences in the language by composing terminal and non-terminal expressions into a that mirrors the grammar's production rules.

Applicability and Problems Solved

The Interpreter pattern finds applicability in situations where a simple language must be interpreted, and its statements can be effectively represented as abstract syntax trees (ASTs). This approach is particularly useful for defining a grammatical of a (DSL) and providing an interpreter to evaluate sentences within it, enabling the processing of structured inputs like expressions or rules without bespoke procedural logic. It solves key problems associated with interpreting such languages without a systematic , including code duplication arising from handling similar rules in an ad-hoc manner and challenges in maintaining and extending the as requirements evolve. For example, in scenarios involving nested expressions in query processors or script evaluators, traditional chains or switch statements often lead to repetitive implementations for each rule variant, complicating and introducing maintenance overhead. The pattern is ideal when the grammar remains straightforward—typically involving a limited set of rules—and is unlikely to undergo frequent modifications, as increasingly complex grammars result in bloated class hierarchies that become difficult to manage. In such cases, alternatives like parser generators are preferable to avoid these proliferation issues. Additionally, it should be employed only when efficiency is not paramount, since direct AST traversal can incur performance costs compared to compiled or optimized representations, such as state machines for regular expressions.

Structure and Components

Key Participants

The Interpreter pattern defines a set of classes that collaboratively interpret sentences in a language, structured around an (AST) composed of expression nodes. Each participant plays a distinct role in building, representing, and evaluating these expressions according to a . AbstractExpression declares an abstract Interpret() operation common to all nodes in the AST, providing a uniform for interpreting any expression regardless of its complexity. This enables polymorphic treatment of both simple and composite expressions during traversal and evaluation. TerminalExpression implements the Interpret() operation for terminal symbols in the grammar, such as numeric literals or primitive operations that form the leaves of the AST. It performs interpretation directly on the provided context without recursing into child expressions, serving as the foundational elements that cannot be further decomposed. NonterminalExpression represents nonterminal symbols by maintaining references to an aggregate of child expressions—either TerminalExpressions or other NonterminalExpressions—and implements Interpret() by recursively calling the operation on each child, then combining their results in accordance with the specific grammar rule it embodies. This recursive structure allows the pattern to handle hierarchical language constructs efficiently. Context encapsulates global information pertinent to the interpretation, including the input to be parsed (e.g., a string or stream), variable bindings, or accumulated results, which is passed to expression nodes to inform their behavior without tight coupling between interpreters. Client assembles the by instantiating and linking TerminalExpressions and NonterminalExpressions to match the target sentence's structure, initializes the with relevant data, and triggers interpretation by invoking Interpret() on the tree's . This participant orchestrates the overall process but remains decoupled from the specifics of individual expression evaluations.

UML Diagrams

The UML class diagram for the Interpreter pattern illustrates the structural hierarchy and relationships among its core participants, providing a visual blueprint for implementing a interpreter. At the top, an abstract or named AbstractExpression serves as the base, declaring a single abstract operation interpret(Context context) that defines the common for interpreting expressions. Two subclasses inherit from AbstractExpression: TerminalExpression, which implements interpret() to handle nodes (simple symbols or values in the without further decomposition), and NonterminalExpression, which also implements interpret() but recursively invokes the method on its child expressions to process composite rules. Additionally, a Context is depicted, typically as a simple entity holding global information such as input data or state shared across interpretations, with the interpret() operations depending on it. The diagram emphasizes inheritance through generalization arrows from TerminalExpression and NonterminalExpression to AbstractExpression, ensuring polymorphic behavior. A key association is the composition relationship within NonterminalExpression, shown as a 1-to-many link to AbstractExpression (often via an attribute like List<AbstractExpression> expressions), allowing nonterminal nodes to aggregate multiple sub-expressions into a syntax tree. The Client (not always explicitly diagrammed but implied) interacts with Context and the root AbstractExpression, building and traversing the tree. This structure aligns with the pattern's goal of representing a language grammar as a class hierarchy, where terminal classes map to atomic rules and nonterminal classes to production rules. An accompanying UML object diagram demonstrates runtime instantiation, exemplifying how the class structure forms a composite (AST) for a specific expression, such as "2 + 3 * 4". In this visualization, a root object of type NonterminalExpression (representing ) links via to a terminal object TerminalExpression (value 2) on the left and another NonterminalExpression (representing multiplication) on the right. The multiplication node further composes two TerminalExpression objects (values 3 and 4), forming a that mirrors operator precedence. Each object instance shows attribute values (e.g., the expressions list populated with child references) and links back to a shared Context object containing the input string or evaluation state. This object diagram highlights the pattern's recursive at , where traverses the depth-first to compute results like 14. Key relationships in these diagrams underscore the pattern's reliance on for building hierarchical structures: the 1-to-many aggregation in NonterminalExpression enables flexible tree construction without fixed , while the from all expressions to Context ensures centralized during traversal, avoiding global variables. These notations conform to UML conventions for behavioral patterns, facilitating clear communication of the in object-oriented modeling tools.

Implementation

Core Steps

The implementation of the Interpreter pattern follows a structured sequence of steps to define, represent, and evaluate expressions in a . This process ensures that the grammar is translated into an object-oriented structure suitable for recursive interpretation, leveraging an (AST) to process inputs systematically. The first step is to define the of the , specifying its production rules, and map these rules to classes within the pattern's . Each nonterminal production rule corresponds to a subclass of an abstract NonterminalExpression, while terminal symbols are handled by TerminalExpression subclasses; this mapping creates a representation where the grammar's structure directly informs the object model. Next, implement the interpret method recursively across the expression classes to traverse and evaluate the . This method, defined in an abstract Expression interface or superclass, takes a object to manage global state such as input data or intermediate results; nonterminal expressions invoke interpret on their child expressions, combining results according to the grammar rule, while terminal expressions perform base-level operations like retrieving literal values. The third step occurs in the client code, where the is constructed based on the parsed input expression by instantiating and composing the appropriate TerminalExpression and NonterminalExpression objects into a , with the representing the overall expression. Once built, the client calls the on this , propagating down the tree via to produce the final output. Recursion is handled by distinguishing base cases in terminal expressions, which return concrete values without further calls, from nonterminal expressions that recursively delegate to sub-expressions before applying the rule's logic, ensuring the evaluation terminates for valid finite grammars.

Design Considerations

When applying the Interpreter pattern, performance is a primary concern, particularly for grammars involving , which can lead to exponential in large or deeply nested expressions due to repeated traversals of the expression tree. To mitigate this, designers often integrate the to share common subexpressions across interpretations, reducing memory usage and computation by caching and reusing immutable terminal nodes rather than recreating them. Extensibility is one of the pattern's strengths, as new grammar rules can be added by subclassing the abstract expression , allowing the interpreter to handle additional sentence structures without modifying existing code. However, this reliance on can result in a class explosion for moderately complex grammars, where each production rule requires a new subclass, leading to a bloated that becomes difficult to maintain and extend further. Error handling in the Interpreter pattern typically involves embedding validation logic within the interpret of expression classes to detect invalid inputs, such as malformed sentences or type mismatches, and propagating via exceptions or by updating flags in the shared context object to signal failures without halting the entire interpretation process. The pattern should be avoided for complex languages with ambiguous or large , where manual class hierarchies become unwieldy; in such cases, parser generators like are preferable, as they automate the creation of efficient lexers, parsers, and walkers from grammar specifications.

Examples

Simple Expression Evaluator

The Simple Expression Evaluator serves as an introductory implementation of the Interpreter pattern, focusing on a minimal for arithmetic expressions limited to , such as "2 + 3". This example constructs an (AST) where leaf nodes represent numeric values and internal nodes represent the addition operator, enabling recursive evaluation to compute the result. By defining rules as classes, the pattern allows straightforward extension for additional operators while maintaining a clear separation between and interpretation. Central to this evaluator are two key expression types: terminal and non-terminal. The terminal expression, NumberExpression, encapsulates a literal numeric value and serves as the base case in the recursion. It implements an interpret method that simply returns the stored value, fulfilling the role of a primitive element in the grammar without further decomposition.
java
abstract class Expression {
    public abstract int interpret();
}

class NumberExpression extends Expression {
    private final int number;

    public NumberExpression(int number) {
        this.number = number;
    }

    @Override
    public int interpret() {
        return number;
    }
}
The non-terminal expression, AdditionExpression, represents the addition operator by composing two sub-expressions (left and right operands). Its interpret method recursively invokes interpret on each child, summing the results to propagate evaluation up the tree. This structure mirrors the pattern's emphasis on hierarchical composition for complex sentences in the language.
java
class AdditionExpression extends Expression {
    private final Expression left;
    private final Expression right;

    public AdditionExpression(Expression left, Expression right) {
        this.left = left;
        this.right = right;
    }

    @Override
    public int interpret() {
        return left.interpret() + right.interpret();
    }
}
In practice, a client application parses the input expression—such as tokenizing "2 + 3" into operands and operator—to build the corresponding , for instance, new AdditionExpression(new NumberExpression(2), new NumberExpression(3)). Evaluation begins by calling interpret on the root node, triggering recursive traversal: the AdditionExpression computes the sum of its children's interpretations, ultimately yielding 5 for the example. This flow decouples the representation from the evaluation logic, allowing the same to support multiple interpretations if extended.

Advanced Rule-Based Interpreter

In rule-based systems, the Interpreter pattern facilitates the evaluation of complex logical conditions derived from rules, such as eligibility criteria expressed in a simple . For instance, a rule like "if age > 18 then eligible" can be parsed into an of expressions, where each node represents a condition or operator, enabling dynamic interpretation without recompiling the application. This approach is particularly useful for configurable rule engines in domains like or compliance, where rules evolve frequently. The core structure revolves around an abstract BooleanExpression class or interface that defines an interpret(Context context) method returning a boolean value. Concrete subclasses include VariableExpression for handling context-dependent variables, such as comparing a user's age against a threshold. AndExpression and OrExpression serve as non-terminal expressions that compose multiple sub-expressions using logical conjunction and disjunction, respectively. The Context class typically implements a key-value store, like a Map<String, Object>, to provide runtime values for variables during evaluation. A representative implementation in Java might define the expressions as follows:
java
import java.util.HashMap;
import java.util.Map;

// Abstract base for boolean expressions
abstract class BooleanExpression {
    abstract boolean interpret(Context context);
}

// Handles variable comparisons, e.g., "age > 18"
class VariableExpression extends BooleanExpression {
    private String variableName;
    private int threshold;
    private String operator; // e.g., ">", ">="

    public VariableExpression(String variableName, int threshold, String operator) {
        this.variableName = variableName;
        this.threshold = threshold;
        this.operator = operator;
    }

    @Override
    boolean interpret(Context context) {
        Object value = context.get(variableName);
        if (value instanceof Integer) {
            int intValue = (Integer) value;
            return switch (operator) {
                case ">" -> intValue > threshold;
                case ">=" -> intValue >= threshold;
                default -> false;
            };
        }
        return false;
    }
}

// Logical AND of two expressions
class AndExpression extends BooleanExpression {
    private BooleanExpression left;
    private BooleanExpression right;

    public AndExpression(BooleanExpression left, BooleanExpression right) {
        this.left = left;
        this.right = right;
    }

    @Override
    boolean interpret(Context context) {
        return left.interpret(context) && right.interpret(context);
    }
}

// Logical OR of two expressions (similar structure to AndExpression)
class OrExpression extends BooleanExpression {
    private BooleanExpression left;
    private BooleanExpression right;

    public OrExpression(BooleanExpression left, BooleanExpression right) {
        this.left = left;
        this.right = right;
    }

    @Override
    boolean interpret(Context context) {
        return left.interpret(context) || right.interpret(context);
    }
}

// Context holds variable values
class Context {
    private Map<String, Object> values = new HashMap<>();

    public void set(String key, Object value) {
        values.put(key, value);
    }

    public Object get(String key) {
        return values.get(key);
    }
}
To evaluate a nested rule like "(age > 18 and income > 50000)", the expressions are composed into a tree:
java
// Build the expression tree
BooleanExpression ageExpr = new VariableExpression("age", 18, ">");
BooleanExpression incomeExpr = new VariableExpression("income", 50000, ">");
BooleanExpression rule = new AndExpression(ageExpr, incomeExpr);

// Set context values
Context context = new Context();
context.set("age", 20);
context.set("income", 60000);

// Evaluate
boolean isEligible = rule.interpret(context); // Returns true
The evaluation proceeds recursively: leaf nodes like VariableExpression query the directly, while composite nodes like AndExpression invoke interpret on their children before applying the . For deeply nested conditions, depth corresponds to the tree's height, potentially reaching several levels in complex rules, which underscores the pattern's scalability for hierarchical logic while risking in extreme cases if not managed.

Applications and Consequences

Common Uses

The Interpreter pattern enables the evaluation of expressions defined by a , structuring complex grammars as abstract syntax trees where each node represents a element that can be recursively interpreted. This makes it suitable for domains requiring dynamic evaluation without full compilation. In domain-specific s (DSLs), the Interpreter pattern facilitates the processing of files and specialized notations by defining representations that can be executed directly. The pattern plays a key role in compilers and interpreters for lightweight scripting and expression evaluation. SQL parsers in database systems use the pattern to interpret query grammars, breaking down statements into executable components for optimization and execution. In rule engines for , the Interpreter pattern supports the evaluation of dynamic conditions and actions, enabling scalable handling of complex, changeable rules without recompiling the core application.

Advantages and Limitations

The Interpreter pattern provides high flexibility for grammar extensions, as new rules can be incorporated by defining additional or nonterminal expression classes, allowing modifications to the without altering client code. This approach also ensures a clear separation between , which constructs the (AST), and execution, which traverses and evaluates the tree, promoting in language processing systems. Furthermore, is facilitated through AST traversal, enabling straightforward inspection and modification of the expression structure during interpretation. Despite these benefits, the pattern exhibits notable limitations, particularly in and . It incurs high usage for deep or complex ASTs due to the storage of each element as an object, resulting in O(n) space complexity proportional to the input size. For large inputs, this can lead to inefficiency, compounded by potential stack overflows in deeply nested expressions during recursive evaluation. Additionally, maintaining the pattern becomes burdensome for complex grammars, as it requires a proliferation of classes—one per rule—leading to increased code complexity and potential violations of the open-closed principle over time. To mitigate these drawbacks, hybrid approaches often combine the Interpreter pattern with the , leveraging the latter to separate traversal logic from interpretation concerns and enabling non-recursive processing of the for better performance and extensibility. In comparison to alternatives like parser generators (e.g., or ), the Interpreter pattern is particularly well-suited for prototyping domain-specific languages or simple grammars, where rapid development outweighs the need for optimized, production-scale parsing efficiency.

Similar Behavioral Patterns

The Interpreter pattern exhibits similarities with other behavioral patterns in its use of recursive structures and encapsulation of behavior, though it also draws on structural patterns for its core implementation. The Visitor pattern facilitates the separation of algorithms from the object structures they operate on, making it particularly useful alongside the Interpreter pattern for traversing abstract syntax trees (ASTs) without modifying the underlying expression classes. This allows for the addition of diverse operations, such as different evaluation strategies or optimizations, on the expressions represented in the AST. As noted in the Gang of Four's seminal work, the Visitor pattern is recommended when multiple interpreters are frequently developed, as it externalizes the interpretation logic into dedicated visitor objects that can be applied polymorphically across the expression hierarchy. Although classified as a , the underpins the recursive composition of expressions in the Interpreter pattern, enabling uniform handling of both primitive (terminal) and complex (non-terminal) elements within the . This shared recursive traversal mechanism aligns the two patterns in building hierarchical representations that can be processed interpretively. The explicitly describes the AST in the Interpreter as an instance of the Composite pattern, highlighting how it supports treating individual objects and their compositions equivalently. The parallels the Interpreter in encapsulating requests or behaviors as invocable objects, where expressions in the Interpreter serve a role akin to commands that can be composed and executed. However, while the Interpreter emphasizes recursive evaluation of language grammars, the Command pattern prioritizes features like undoability, queuing, and parameterization of actions. Both patterns, as behavioral designs from the , promote flexibility in delegating responsibilities to objects rather than procedures. The supports navigation through the expression tree in the Interpreter, enabling orderly traversal—such as depth-first or breadth-first—without exposing the tree's internal structure to clients. This is especially relevant given the composite nature of the , where iterators can decouple traversal logic from . The of Four's implies this applicability through the Composite integration, and subsequent analyses confirm Iterator's in recursive hierarchies like those in interpreters.

Differences from Other Patterns

The Interpreter pattern differs from the primarily in its approach to handling interpretation problems: it provides a direct recursive of parse trees representing grammars, whereas the State pattern transforms such trees into state machines to manage object behavior changes based on internal states, often without for rules. In contrast to the , which encapsulates interchangeable algorithms for varying behavior in fixed operations, the Interpreter pattern composes dynamic grammars through hierarchical expression classes to evaluate complex, language-like expressions on demand. Unlike the , which separates the stepwise construction of complex objects from their representation without inherent evaluation, the Interpreter pattern builds and evaluates abstract syntax trees interpretively in a single process, focusing on runtime execution of grammar rules rather than object assembly. Selection criteria for the Interpreter pattern emphasize language-like domains where statements can be modeled as abstract syntax trees with simple grammars and non-critical efficiency needs; for full compilers or complex , parser generator tools are preferable over this pattern's approach.

References

  1. [1]
    Design Patterns: Elements of Reusable Object-Oriented Software
    30-day returnsOct 31, 1994 · Design Patterns: Elements of Reusable Object-Oriented Software. By Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides; Published Oct 31, ...
  2. [2]
    Interpreter
    Given a language, define a represention for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
  3. [3]
    Design Patterns - Interpreter Pattern
    Interpreter pattern provides a way to evaluate language grammar or expression. This type of pattern comes under behavioral pattern.
  4. [4]
    Interpreter Design pattern.
    The Interpreter pattern is very useful for adding functionality to Composite pattern structures. Composites represent multi-part systems that are being accessed ...
  5. [5]
    Interpreter Design Pattern
    Intent. Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.Discussion · Structure · Example
  6. [6]
    Interpreter Design Pattern in Java | Baeldung
    Jan 8, 2024 · In short, the pattern defines the grammar of a particular language in an object-oriented way which can be evaluated by the interpreter itself.<|control11|><|separator|>
  7. [7]
    Interpreter - UNC Computer Science
    The Interpreter pattern describes how to define a grammar for simple languages, represent sentences in the language, and interpret these sentences.
  8. [8]
    Interpreter Design Pattern Example - Java Code Geeks
    Sep 30, 2015 · ... Design Patterns and see how. ... When to use the Interpreter Design Pattern. Use the Interpreter pattern ...<|control11|><|separator|>
  9. [9]
    Why is the Interpreter design pattern not applicable when efficiency ...
    Dec 15, 2022 · In the book Design Patterns, written by the Gang of Four, the following is stated in the 'Applicability' section of the Interpreter pattern:.
  10. [10]
    Interpreter Design Pattern - GeeksforGeeks
    Dec 20, 2024 · The Interpreter design pattern is a behavioral design pattern that defines a way to interpret and evaluate language grammar or expressions.Components of the Interpreter... · Interpreter Design Pattern...
  11. [11]
    Interpreter Pattern | Object Oriented Design
    The Interpreter pattern focuses on defining grammars, tokenizing input, and is particularly useful in rules engines and enhancing the composite pattern with ...Missing: Gang | Show results with:Gang
  12. [12]
    Interpreter Pattern Tutorial
    Apr 25, 2023 · ... Context. create context class; Move ... TerminalExpression and NonterminalExpression will inherit the operations from AbstractExpression.
  13. [13]
    Interpreter Pattern - Spring Framework Guru
    dInterpreter pattern is part of the Behavioral pattern family of the Gang of Four design patterns. Behavioral patterns address responsibilities of objects in an ...
  14. [14]
    Interpreter Design Pattern: A Quick Learning - ScholarHat
    Sep 16, 2025 · Interpreter design pattern is a behavioral design pattern that falls under the gang of four design patterns. By creating a grammar and an ...
  15. [15]
    [PDF] Design Pattern Summary
    Applicability – use the Interpreter pattern when: – The grammar is simple ... For example, you might define algorithms reflecting different space/time trade-offs.
  16. [16]
    [PDF] Interpreters and visitors - DSpace@MIT
    Disadvantages: The interface may not (efficiently) provide all desired operations. Indirection may reduce performance. Iterator. Problem: Clients that wish to ...
  17. [17]
    Design Patterns - Interpreter Pattern - Tutorials Point
    Design Patterns - Interpreter Pattern ... Interpreter pattern provides a way to evaluate language grammar or expression. This type of pattern comes under ...Implementation · Terminalexpression. Java · Andexpression. JavaMissing: book | Show results with:book
  18. [18]
    How to work with the Interpreter design pattern - InfoWorld
    The Interpreter design pattern lets you define your application's business rules as classes. You can take advantage of this design pattern to build domain- ...<|control11|><|separator|>
  19. [19]
    State Chart XML (SCXML): State Machine Notation for ... - W3C
    Sep 1, 2015 · This document outlines State Chart XML (SCXML), which is a general-purpose event-based state machine language that combines concepts from CCXML ...
  20. [20]
    Evaluating Expressions - Crafting Interpreters
    In effect, we could tell each syntax tree node, “Interpret thyself”. This is the Gang of Four's Interpreter design pattern.
  21. [21]
    Real-World Rule Engines - InfoQ
    Jun 19, 2006 · Geoffrey Wiseman explains rules engines and shares practical experiences applying them with Drools in financial services.A Rule Engine Primer · Architecting With Rule... · Rule Engine Patterns And...
  22. [22]
    Drools rule engine
    The basic function of the Drools rule engine is to match incoming data, or facts, to the conditions of rules and determine whether and how to execute the rules.
  23. [23]
    [PDF] A Case of Visitor versus Interpreter Pattern - CWI
    Abstract. We compare the Visitor pattern with the Interpreter pattern, investigat- ing a single case in point for the Java language.Missing: limitations | Show results with:limitations
  24. [24]
    The Interpreter Pattern
    The three main players are Context, Expression, and Value. In order to evaluate an expression, such as "x + 2" we need to know the value of x. The context might ...Missing: design | Show results with:design<|control11|><|separator|>
  25. [25]
    [PDF] Chapter 23: Interpreter Design Pattern
    The interpreter pattern is only applicable if the solution to the problem at hand can be expressed in terms of a formal grammar. If the problem offers a ...
  26. [26]
    [PDF] Design Patterns Elements of Reusable Object-Oriented Software
    Design Patterns : elements of reusable object-oriented software / Erich ... pattern will also contain the Interpreter pattern. But the Interpreter ...