From the course: Python: Advanced Design Patterns

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Interpreter

Interpreter

- [Narrator] Experts in a particular field often develop their own language called a domain-specific language. They use special terms to refer to certain concepts. This jargon allows them to quickly convey what needs to be communicated without needing to explain the details every time. The interpreter pattern makes it possible to use this kind of a domain-specific language to perform a task on your computer. To make this happen, your computer needs an interpreter program that translates an expression into something it can understand. The interpreter pattern provides clever design guidance on how to go about doing this. Here the focus is not too much on building a comprehensive and huge computer language like Python. The pattern is more about a small, custom language you need to create to avoid writing different code repeatedly to conduct similar tasks. A good example is a problem of searching particular patterns in a text. We already have a well-developed language for conducting these…

Contents