Skip to content

Building an Interpreter for the Rune DSL

minesh-s-patel edited this page Jun 13, 2024 · 1 revision

Proposal: Building an Interpreter for the Rune DSL

Owner: Simon Created time: May 29, 2024 10:07 AM

The project aims to develop an interpreter for the open-source Rune DSL (domain specific language), providing users with the ability to input expressions, obtain results, and receive diagnostic information for errors.

Rune, used in the financial domain for digitally regulatory reporting, currently relies on code generation to Java to evaluate and validate expressions. Although compiled Java code is in general more performant than an interpreter, this is not the case for the specific scenario when developing Rune code: code generation and compilation is too much of an overhead while writing code. It is in this situation that an interpreter can shine.

The Rune DSL has two unusual features.

  1. It combines the concept of cardinality - a typical concept for modelling languages - with the concept of expressions and functions - a typical concept for programming languages. This makes for an interesting semantics: each expression has an associated cardinality, and may evaluate to one value, multiple values, or no value at all.
  2. Rune has a high error tolerance. Unlike most programming languages which will terminate evaluation from the moment an error occurs, Rune can handle partial errors gracefully and proceed with the evaluation of partial results.

Both of these features have interesting consequences for the interpreter.

Key Features:

  1. Interpreter Design:
    • Design a representation of evaluated Rune expressions in Java.
    • Design support for evaluating various types of expressions, functions, and operations present in the DSL.
  2. Cardinality:
    • The implementation should be able to handle cardinality. The design should take into account that any expression may evaluate to one value, multiple values, or no value at all.
  3. Validation:
    • The interpreter should be able to validate instances of Rune types and provide diagnostics if conditions are violated.
  4. Error Tolerance:
    • Implement a diagnostic system to propagate errors in Rune expressions without terminating, enabling graceful handling for partial errors.

Preferred Frameworks/Languages:

  • Java for the interpreter implementation. Familiarity with the Xtext framework for DSL design can help.

This project builds on top of the material that students have seen in the course on Concepts of Programming Languages. It offers them the opportunity to delve into the complexities of language interpretation, bridging theory with practical application in the financial domain. The interpreter's implementation will require careful consideration of the Rune DSL's unique syntax and semantics. Students will engage in problem analysis, research existing interpreter designs, and subsequently create a reliable solution that enhances the usability and functionality of the Rune DSL.

Relevant links: