jueves, 20 de octubre de 2016

[Discussion] Language Design and Implementation using Ruby and the Interpreter Pattern

Today I’m writing an interesting review, it is about a paper published by our class professor, Ariel Ortiz R.. Language Design and Implementation using Ruby and the Interpreter Pattern is the name of the paper, you can find it here[1].

This paper is particularly interesting for me because it involves a topic using the Ruby programming language, which is the one I love the most.

In general terms, the article talks about a framework called S-expression Interpreter Framework (SIF) which is like a DSL written for Ruby that allows you to interpret S-Expressions such like the ones from Lisp. This framework reminds me an article I red before about implementing Lisp in just 32 lines of Ruby code.[2]

This framework is an example of why I love Ruby. Thanks to using the Interpreter pattern, which by the way it’s also very easy to implement in Ruby, Ariel has managed to create a way that run Lisp-like programs.

When I was reading the article I didn’t get how this could be related to the Compiler Design course. After a while I understood that S-expressions are very useful when I compared to grammar definitions. And googled some exercises about compilers and in many cases I found examples of people implementing Lisp-like languages. I got amazed of the simplicity of this constructions!

I would liked to use this framework when I was taking the Programming Languages Course, most of all because the framework is developed in Ruby. Although it might not be the best language of the world, it’s very useful when you use it as a base for creating new frameworks or as a companion for teaching concepts.

Specifically about the SIF, it seems very extensible. I liked the way of how you can modify it very easily and add custom constructions using only just a new Ruby class.

References

[1] http://webcem01.cem.itesm.mx:8005/publicaciones/sif.pdf
[2] http://blog.fogus.me/2012/01/25/lisp-in-40-lines-of-ruby/

0 comentarios:

Publicar un comentario