I remember during my Software Architecture Course (imparted by Professor Ariel Ortiz, who imparts Compilers Design, Programming Languages, and was also my current boss' teacher) we were assigned a task for the interpreter pattern. Basically, we had to create a DSL for s-expressions (or something that looked like them) using the Ruby language, which was, in itself, a titanic task. I'm grateful this particular pattern was not a part of the curricula for the final exam.
Now, while taking this Compiler Design course, I wish the whole affair could be done using Ruby.
While examining some of the topics pertaining Compiler Design, I can't help but wonder some details that are reminiscent of the Programming Languages course. For one, I find Bison's syntax to be similar to s-expressions, switching of course parentheses for brackets. It still seems to follow some of the same convensions, each statement or line to be evaluated is accessed as a list, and through its indexes, values located at a certain place are evaluated as specified in the rules.
Another excercise Professor Ariel seems to be quite fond, is processing operator-first syntax with a basis on regular old operations.
It is to be expected that lisp-like syntax would have its advantages in designing compilers, it offers easy recursion, and the fact that the operator is written first, makes everything simpler to be processed by reducing the number of grammar elements.
Now, while taking this Compiler Design course, I wish the whole affair could be done using Ruby.
While examining some of the topics pertaining Compiler Design, I can't help but wonder some details that are reminiscent of the Programming Languages course. For one, I find Bison's syntax to be similar to s-expressions, switching of course parentheses for brackets. It still seems to follow some of the same convensions, each statement or line to be evaluated is accessed as a list, and through its indexes, values located at a certain place are evaluated as specified in the rules.
Another excercise Professor Ariel seems to be quite fond, is processing operator-first syntax with a basis on regular old operations.
It is to be expected that lisp-like syntax would have its advantages in designing compilers, it offers easy recursion, and the fact that the operator is written first, makes everything simpler to be processed by reducing the number of grammar elements.
No hay comentarios:
Publicar un comentario