© Kelt Dockins 2017

Kelt Dockins, Design Patterns in PHP and Laravel, 10.1007/978-1-4842-2451-9_18

18. Interpreter

Kelt Dockins

(1)Dolph, Arkansas, USA

$> git checkout interpreter

Intent

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

Applications

There are some patterns you might never use: flyweight, singleton, and this one. I am going to cover it anyway. Just in case. I have been wrong before. This chapter is a tad bit more theoretical than others. To understand the interpreter pattern, I need to talk first about language and grammar. Understanding how to work with grammar will make you sound more intelligent to others. This also happens ...

Get Design Patterns in PHP and Laravel 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.