Ruby and the Interpreter Pattern
In order to have a better understand of how a compiler works is to understand the language design and patterns. I think that SIF is a very interesting tool that allows us to get an overall knowledge about design patterns. S-expressions are parenthesis prefixed, like Clojure, language that we see last semester, and has many useful features in order to accomplish this goal, such as ease of adding new language construct and writing a parser to it. Basically, the interpreter first creates a tree with each element of the source code, giving to each element a specific node type. Then, each node has a specific function or task to do. Also, a context is provided to the function that consists basically in a variable table. So, the interpreter uses a string as the source code. Later, it uses the Ruby regular expression API to scan the input, then the syntax analysis is performed and finally the tree is constructed. So, I think that an interpreter is a reduced version of a comp...