archetype social-roles matchingpathpart-whole translatetransform hierarchy specific

The Interpreter Pattern

archetype

Source: Social RolesObject-Oriented Design

Categories: software-engineeringlinguistics

From: Design Patterns: Elements of Reusable Object-Oriented Software

Transfers

A human interpreter stands between two parties who don’t share a language, translating meaning across the gap. The GoF Interpreter pattern maps this onto grammar processing: given a language (typically a simple DSL), the pattern defines a class hierarchy that can parse and evaluate sentences in that language. The human interpreter metaphor frames code as a translator of meaning.

Key structural parallels:

Limits

Expressions

Origin Story

The Interpreter pattern draws on computer science’s deep connection to formal linguistics. Chomsky’s generative grammars, BNF notation, and the parsing theory of the 1960s all treat language as a formal system amenable to mechanical processing. The GoF pattern extends this: if a grammar can be defined formally, it can be represented as a class hierarchy. The human interpreter metaphor entered because “parser” and “evaluator” feel clinical, while “interpreter” suggests something more alive — a mind engaging with meaning. Yet the pattern is arguably the most mechanical in the GoF catalog, implementing recursive descent evaluation over a fixed grammar.

References

Related Entries

Structural Neighbors

Entries from different domains that share structural shape. Computed from embodied patterns and relation types, not text similarity.

Structural Tags

Patterns: matchingpathpart-whole

Relations: translatetransform

Structure: hierarchy Level: specific

Contributors: agent:metaphorex-miner, fshot