The Interpreter Pattern

First of all, I want to preface this blog, stating that I have two courses with my teacher <Ariel Ortiz> the first one, is Software Design and Architecture, where we evaluate and see different Refactorings and Coding Patterns. One of the patterns we started to see was the Interpreter pattern. This pattern allows us to build a Domain specific language for solving a problem. In this case, the program that we had to write was Rock Paper Scissors Lizard Spock. It is based on a meme from the program called the Big Bang Theory.

Going on, after implementing this process, I found in the book that was studied, a DSL for creating a maps implementation. What if, Google maps or Apple maps were coded in a DSL? This could be interesting info. What other implementations of implementing a language existed out there?

That prefaces this wonderful article, by Ariel Ortiz, where he stablishes an S-Expresison language, mainly used in Lisp, that works in this way ( expr input ). 

Adding to his wonderful article, we also saw his conference on “Applying the eval apply loop in clojure.” We could in theory, express a subset of Lisp in this SIL.

I am only yearning for the day we can implement lisp equivalent expressions without long parenthesis. That’s why I’ve started to learn python 3, which allows for the *kwargs pointer that allows similar evaluation to randomly assigned arguments.

I think the future is expanding to this kind of expressions, having a list comprehension of undefinite arguments, allow things like map reduce being way more useful than we thought previously.

This showing of the interpreter pattern is only going to open our paradigms even more for doing creative solutions. I’ve never had thought of solving a problem like this before. Thank you teacher.


“Language Design and Implementation using Ruby and the Interpreter Pattern” by Ariel Ortiz 


views