jueves, 24 de noviembre de 2016

Ruby and the Interpreter Pattern

For this occasion the article that we had to read talks about an interpreter Framework developed by our professor Ariel Ortiz using the Ruby language. In a past course we learned to program in Ruby, it seemed to me a friendly and nice language, unfortunately, it was not much time that we was working with this language and, at least me, I have not investigated more about it.

Returning to the subject, Ruby is an interpreted, dynamically typed programming language. Its syntax borrows from Eiffel, Ada, and Perl, and it’s fully object-oriented in the spirit of Smalltalk. I remember that everything in Ruby is an object, including: strings, numbers, arrays (lists), hashes (maps or dictionaries), symbols, procedures (closures), and even classes.

About the syntax: local variables, method parameters, and method names should all start with a lowercase letter or with an underscore. Global variables are prefixed with a dollar sign ($), while instance variables begin with an “at” sign (@). Class variables start with two “at'” signs (@@). Finally, class names, module names, and constants should start with an uppercase letter. I also remember that it is not used semicolon or parentheses as in other languages. To end a function the word "end" is written.

The article mentions that, “The author has used the S-expression Interpreter Framework in his Programming Language course several times since mid 2005”, And that students at the end of the course ensure that, “they enjoyed the SIF approach and that it helped them to have a better understanding of how programming languages work”.


The S-expression Interpreter Framework (SIF) provides the basic building blocks that allow writing interpreters that can easily be studied, extended and modified. Particularly useful is the SIF’s special form definition mechanism, which allows a clear distinction between the syntax and semantics of any language construct.  

No hay comentarios:

Publicar un comentario