ruby and interpreter pattern

Hi again. This time i'll talk about an special article named Language Design and Implementation using Ruby and the Intepreter Pattern. This article was written by my compiler's teacher Ariel Ortiz and the article was published as a part of ACM issue. And as you can read in the title, this is going to be about Ruby so that teaching software design, in a way more easy. Also he talks about like a mini compiler that its functionality is nearly like Lisp and takes Ruby code to create data structures, which are nearly similar to the ones of Lisp, that is very useful because it can eliminate ambiguity on things that are vrey diffucult to understand or difficult to interpret.

That very interesting, because when you take the entity tree, you can create pseudo language that helps programmers to understand more the functionality of the compiler and its structure.

S-expressions are parenthesis prefixed language like Clojure, which is a language that I've already learn in a previus course. This langugage has some good features as like the ease of adding new language construct and writint the parser of it. This interpreter create a tree with all the elements of the code, then locate them in nodes, each node with a function. Then use Ruby's regular expressions in order to scan the input, sintax analysis is made and the tree is constructed.

Is very interesting to know how a language you studied before works. I think that dessign patterns are very important to understand when you are designing a compiler. Each day it becomes more and more difficult when the phases of the compiler pass by, and each article or podcast or any multimedia information I have to read oe watch, gives me more information and motivation in order to finish it.

Comentarios

Entradas populares de este blog

The hundred-year language

Internals of GCC