Chapter 5: S-expression Interpreter Framework.


The paper I read this time was about how the S-expression Interpreter Framework (SIF) is presented as a tool for teaching language design and implementation. The S-Expressions described in the paper are parenthesized prefix notation, that helps making code and data easily represented, making the parser easier to write, and no problems regarding operator precedence or associativity.

The paper also describes what the Interpreter Pattern consists on, where the program is described as a tree, in which each element is represented by a node, which responds to a special operation called interpret. Using Ruby to build interpreters have many advantages, such as built-in regular expressions, garbage collection, built-in hashes, open classes, and first-class continuations. Another huge benefit from Ruby is that everything is treated like an object, strings, numbers, arrays, hashes, symbols, procedures, and even classes.

SIF only supports integers, symbols, list and procedures, where a number evaluates to itself, a symbol is a variable reference, an empty list evaluates to itself and a non-empty list is considered a procedure application. With this in mind, SIF can also be used for Functional and Imperative programming, as well as using Continuations.

I think this is a very interesting approach towards teaching, how using a framework specifically for teaching different subjects can lead to a better understanding of the subject. Ariel Ortiz made this framework freely available for anyone to use and modify, having the key characteristic of the clear distinction between the syntax and semantics of any language construct in the framework. The thing I liked the most about the SIF, is that it was built as a tool with the main objective of teaching in mind. I would love to see the potential in this type of approach towards development in any field, maybe we can find really interesting teaching tools in a near future.

References:
Ortiz A. (N.D.) Language Design and Implementation using Ruby and the Interpreter Pattern. Available on: http://webcem01.cem.itesm.mx:8005/publicaciones/sif.pdf

Comments

Popular posts from this blog

Chapter 0: Compiling a Complying Compiler

Chapter 1: The usefulness of Compiler Design that will (Most Likely) never be touched again.