Infoscience

Thesis

Compiling scala for the Java virtual machine

Scala is a new programming language developed at EPFL and incorporating the most important concepts of object-oriented and functional languages. It aims at integrating well with the Java and .NET platforms: their respective libraries are accessible without glue code, and the compiler can produce programs for both virtual machines. This thesis focuses on the compilation of two important concepts of Scala : mixin inheritance and run time types. The compilation techniques are presented in the context of the Java virtual machine, but could be adapted easily to other similar environments. Mixin inheritance is a relatively recent form of inheritance, offering new capabilities compared to single inheritance, without the complexity of multiple inheritance. We propose two implementation techniques for mixin inheritance: code copying and delegation. The implementation used in the Scala compiler is then presented and justified. Run time types make it possible for a program to examine the type of its values during execution. This possibility is interesting in itself, offering new capabilities to the programmer. Furthermore, run time types are also required to implement other high level concepts, like pattern matching, type-safe serialisation and reflection. We propose an implementation technique based on the representation of types as values, and show how to use the run time types of the underlying virtual machine to implement those of Scala. The techniques presented in this thesis have been implemented in our Scala compiler, scalac. This enabled us to evaluate these techniques, in particular their impact on the performances of programs. This evaluation was performed on several real, non-trivial programs.

    Thèse École polytechnique fédérale de Lausanne EPFL, n° 3302 (2005)
    Section d'informatique
    Faculté informatique et communications
    Institut d'informatique fondamentale
    Jury: Rachid Guerraoui, Paolo Ienne, Shriram Krishnamurthi, Mirko Viroli

    Public defense: 2005-9-16

    Reference

    Record created on 2005-07-12, modified on 2016-08-08

Fulltext

Related material

Contacts

EPFL authors