Vergleich und Implementierung von SmallRuby-Interpretierern mittels Tree Walk und Truffle-Framework

  • Dominik Bauernfeind

Student thesis: Master's Thesis

Abstract

This master’s thesis implements two different interpreters for a subset of the Ruby programming language called SmallRuby. Both implementations handle the same language
scope. The aim is to compare a tree walk interpreter with an implementation using the
Truffle framework and the GraalVM. Ruby was chosen because of its dynamics and language properties, while the GraalVM
and the Truffle framework serve as a platform for optimized interpreters.
SmallRuby contains essential Ruby language constructs such as variables, classes and
methods, class-based representation for all data types and block parameters. The parser
generator tool ANTLR is used to implement a lexer and a parser. The visitor design
pattern is used to transform the syntax tree into an abstract syntax tree (AST) for
SmallRuby. A further transformation using the same approach takes place from the
SmallRuby AST to a Truffle-AST. The tree walk interpreter provides a simple and
easily extendable base, while the Truffle interpreter achieves higher execution speed through just-in-time compilation and other GraalVM optimization techniques.
Experiments with programs such as the N-Queens Problem and Conway’s Game of Life show that the Truffle interpreter is significantly faster in execution. A comparison of the code base of both interpreters indicates that using the Truffle framework increases the code in size and complexity. The work shows that the Truffle framework and GraalVM
offer significant performance advantages, while the tree walk interpreter is well suited
for rapid development and testing of new language features.
Finally, the work offers an outlook on possible extensions to SmallRuby and the possibility of using what has been learned to further develop the official implementation of Ruby with the Truffle framework.
Date of Award2024
Original languageGerman (Austria)
SupervisorHeinz Dobler (Supervisor)

Cite this

'