27 lines
1.6 KiB
Typst
27 lines
1.6 KiB
Typst
#import "../requirements.typ": isc-hei-bthesis
|
|
#import isc-hei-bthesis: todo
|
|
#import "../utils.typ": include-offset
|
|
|
|
= Implementation <chap:impl>
|
|
|
|
Now that we have chosen a subset of Python to support and some type checking rules, we may start implementing the type checker itself. We will split the implementation into three relatively independent parts: the Midas language (parsing and registering types), type checking Python and the generator (to output runnable code with runtime assertions).
|
|
|
|
The Python language has been chosen for implementing the type checker for several reasons. First, the student was already greatly familiar with that language and its environment. Secondly, as stated in the introduction, Python is a highly versatile tool which is particularly good at manipulating data, and is easy to iterate with. Then, the student had already implemented a simple interpreter which could be reused and adapted for Midas, as explained in @sec:impl-midas. Finally, Python already provides an `ast` module in its standard library to parse and unparse Python source code, and manipulate its AST nodes.
|
|
|
|
In @sec:impl-overview, we will first look at the whole system from a top-down perspective to locate its components and get a feel of how they connect to each other.
|
|
|
|
#include-offset(path("04_implementation/01_overview.typ"))
|
|
#include-offset(path("04_implementation/02_midas_language.typ"))
|
|
#include-offset(path("04_implementation/03_python_checking.typ"))
|
|
#include-offset(path("04_implementation/04_generation.typ"))
|
|
|
|
/*
|
|
Subjects:
|
|
- Variance inference
|
|
- Environment
|
|
- Resolver
|
|
- Evaluator
|
|
- CallDispatcher
|
|
- Registry (`is_subtype`)
|
|
- MethodRegistry (frames and columns)
|
|
*/ |