Building Type Checker Using Scope Graphs

For a Language with Type Classes

Bachelor Thesis (2023)
Author(s)

A.L. Mocanu (TU Delft - Electrical Engineering, Mathematics and Computer Science)

Contributor(s)

A.S. Zwaan – Mentor (TU Delft - Programming Languages)

Casper Bach Bach Poulsen – Mentor (TU Delft - Programming Languages)

T. Durieux – Graduation committee member (TU Delft - Software Engineering)

Faculty
Electrical Engineering, Mathematics and Computer Science
Copyright
© 2023 Andreea Mocanu
More Info
expand_more
Publication Year
2023
Language
English
Copyright
© 2023 Andreea Mocanu
Graduation Date
29-06-2023
Awarding Institution
Delft University of Technology
Project
CSE3000 Research Project
Programme
Computer Science and Engineering
Faculty
Electrical Engineering, Mathematics and Computer Science
Reuse Rights

Other than for strictly personal use, it is not permitted to download, forward or distribute the text or part of it, without the consent of the author(s) and/or copyright holder(s), unless the work is under an open content license such as Creative Commons.

Abstract

In this paper, we explore scope graphs as a formal model for constructing type checkers for programming languages that support type classes. Type classes provide a powerful mechanism for ad hoc-polymorphism and code reuse. Nevertheless, the incorporation of type classes into type checkers poses challenges, as it necessitates the resolution of instances and the assurance of coherence amidst overlapping instances. Our approach facilitates the separation of concerns between type class resolution and type checking, promoting extensibility and maintainability of the type checker. We contribute with a formal definition of scope graphs for languages with type classes, accompanied by algorithms for type class resolution and type checking. To assess the correctness of this approach, we implement a prototype type checker, and conduct experiments on a collection of representative programs. The results demonstrate the effectiveness of this baseline approach.

Files

License info not available