Student Projects

Are you interested in a semester/master project at LAMP? Here are potential projects that we have thought of. However, feel free to contact us about your own ideas as well.

Most of the following projects are related to Dotty, which is the next-generation Scala compiler, developed in the lab, and slated to become Scala 3.

Last updated on June 3rd, 2020.

A Tasty Interpreter for Scala

Type: master thesis project
Major: computer science, communication systems, data science
Supervisor: Sébastien Doeraene
Students: 1

The goal of the project is to implement an interpreter for Scala based on Tasty. Tasty [1] is the standard immediate representation of Scala programs. Most Scala programs depend on classes defined in JDK, a challenge is how to deal with those dependencies. To alleviate the interop problem, we will develop the interpreter on top of Scala.js [2], which has an implementation of the most commonly used classes of JDK in Scala, and whose interop semantics with JavaScript is well-defined. The evaluation of the project will be whether the interpreter can successfully interpret all the run tests in the Dotty compiler.

  1. Tasty format
  2. https://www.scala-js.org/

ScalaPB (Protobuf bindings) for Dotty with union types

Type: master semester project
Major
: computer science, communication systems, data science
Supervisor: Jamie Thompson
Students: 1

Starting with a ProtoBuf schema, generate Scala classes, types, and access methods to read and write messages according to the schema. Make use of Dotty’s new type features such as union types.

Protobuf with typeclass derivation

Type: master semester project
Major: computer science, communication systems, data science
Supervisor: Jamie Thompson
Students: 1

Starting from a class hierarchy, generate ProtoBuf serializers and deserializers automatically.

Embed the Enriched Effect Calculus in Dotty with Quotes and Splices

Type: master semester project
Major: computer science, communication systems, data science
Supervisor: Jamie Thompson
Students: 1

The Enriched Effect Calculus, EEC, extends the simply-typed lambda calculus (with sums and products) with linear function types and monadic let-binding. This project will embed EEC into Scala through type checking of quotes using the rules of the calculus.

Prior work includes Mesa, a reference type-checker for a dialect of EEC, implemented in Scala.

Error reporting for a Scala template engine

Type: master semester project
Major: computer science
Supervisor: Anatolii Kmetiuk
Students: 1

Thera (https://github.com/anatoliykmetyuk/thera) is a template engine for Scala. It is intended to be used in static website generation. It is similar in purpose to Jekyll for Ruby or Hakyll for Haskell. It allows you to define String templates in which you can refer to variables, define new variables and call functions. For example, one may define an HTML template for a web page that refers to an unbound variable body. One can later reuse that template for all their web pages by substituting the content of the page in place of body.

Currently, the project lacks adequate error reporting capabilities. If an error occurs, an exception is thrown. These exceptions do not provide enough context – such as the name of the template file, the line and column at which the error happened, the text of the line on which it happened etc. A static website may span dozens of files and involve multiple interrelated templates. This complexity makes adequate error reporting an essential feature of the template engine without which it is hard to imagine its widespread adoption.

Your task for this project will be to implement such an error reporting capability. You will learn to detect both syntactic and semantic errors of a simple domain specific language, put them into context and report them to the user in a human-readable way.

Scala support for JAXB

Type: master semester project
Major: computer science
Supervisor: Anatolii Kmetiuk
Students: 2

The following tasks can be done in parallel:

  • JAXB Scala extension
  • JAXB plugin capability to interface with the extension

Jakarta XML Binding (JAXB, https://github.com/eclipse-ee4j/jaxb-ri) is a XML data binding library for Java. It gives Java developers an efficient and standard way of mapping between XML and Java code. Using it, one can generate Java classes from an XML schema and XML schema from Java classes. It can then be used to parse XML files to these classes as well as to serialize the instances of these classes as XML files.

Adding Scala support to JAXB would give the Scala developers a capability to work with complex XML schemas with minimal effort. Existing Scala XML data binding tools may not provide the level of ergonomics JAXB provides for the Java developer, according to some user experiences, and this issue needs to be addressed to ensure Scala as the language of choice for productivity. JAXB currently generates Java classes, whereas for Scala applications case classes, traits and other entities would be desirable.

For this project, you will implement the following Scala capabilities for JAXB:

  • Generate Scala sources from XML schemata
  • Parse XML files that follow the known XML schemata to the generated Scala classes
  • Serialize the instances of the generated Scala classes to XML

To do so, you will:

  • Analyze the JAXB codebase to understand its API and how it works in case of generated Java classes.
  • Plan how to extend JAXB to have the Scala capabilities mentioned above.
  • Plan how to abstract this extension into a stand-alone Scala project.
  • Determine  the minimal capabilities JAXB needs to support to interface with this standalone extension (think rudimentary plugin support for JAXB). To do so, extensively communicate with the JAXB maintainers to come to the common vision that would satisfy both their and our project.
  • Implement the stand-alone Scala extension for JAXB as a separate GitHub repository. Simultaneously, implement all the necessary JAXB plugin capabilities (if any) as a branch of JAXB. Try to make sure this branch gets merged into the JAXB main branch.

Some considerations for this project:

  • Currently, JAXB doesn’t support deep copy of data structures. In practice, this often presents a hurdle. It would be nice to have a deep copy method at least for the Scala-generated structures.
  • Mutability vs immutability. In some cases, we need to modify the parsed classes. In other cases, immutability may be more desirable. It would be nice to give the users control over whether they generate immutable or mutable schema bindings.

Extending GADT support in Dotty (taken)

Type: master semester project
Major: computer science, communication systems, data science
Supervisor: Aleksander Boruch-Gruszecki
Students: 1

GADTs are a special case of Scala sealed traits that can expose additional information about types when we pattern match on them. One can use them to, for instance, encode type-safe expressions – simple [1] or complex [2]. One can find a detailed description here [3].

Support for them was somewhat flawed in Scala 2, but it was improved in Dotty. However, we could improve it even more! So far, one can only add GADT constraints to type parameters of a function. As the representation of a class’ type parameters is different, we could not so far add GADT constraints to them.

This project would consist primarily of finding out how precisely type parameters of a class behave in Dotty, and how to allow GADT-constraining them. In addition, we have a number of outstanding self-contained issues which could be fixed as well.

This is a very good project to take if you’d like to get experience working on a real-world compiler.

  1. gadt-eval.scala
  2. gadt-TypeSafeLambda.scala
  3. Formal foundations for GADTs in Scala

Formalising GADT constraint reasoning in Dotty

Type: master semester project
Major: computer science, communication systems, data science
Supervisor: Aleksander Boruch-Gruszecki
Students: 1

GADTs are a special case of Scala sealed traits that can expose additional information about types when we pattern match on them. One can use them to, for instance, encode type-safe expressions – simple [1] or complex [2].

A previous project [3] studied encoding them into a formal calculus. With this project, we’d like to take a different approach – study the theory of reasoning about how to infer GADT constraints. Briefly: GADT constraints in Dotty follow solely from knowing that a value is of two types simultaneously (see [3] for a detailed explanation). However, such constraints are unwieldy to implement, so in practice in Dotty we “simplify” them into constraints that, we believe, follow from the original ones. In order to ensure that we don’t miss some constraints during such simplification (or don’t make up constraints that are false), during this project we’d formulate a theory of such constraints and show that what we do is sound. Either that, or find out what to fix!

This is a very challenging, pure research topic. A large degree of self-sufficiency and a large amount of work will be required to achieve a good result.

  1. gadt-eval.scala
  2. gadt-TypeSafeLambda.scala
  3. Formal foundations for GADTs in Scala