© Vaskaran Sarcar 2020
V. SarcarDesign Patterns in C#https://doi.org/10.1007/978-1-4842-6062-3_23

23. Interpreter Pattern

Vaskaran Sarcar1 
(1)
Garia, Kolkata, West Bengal, India
 

This chapter covers the Interpreter pattern.

GoF Definition

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

Concept

This pattern plays the role of a translator, and it is often used to evaluate sentences in a language. So, you first need to define a grammar to represent the language. Then the interpreter deals with that grammar. This pattern is best when the grammar is simple.

Points to Note
To better understand this pattern, it is helpful to be familiar with words (or sentences), ...

Get Design Patterns in C#: A Hands-on Guide with Real-world Examples now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.