38 lines
2.1 KiB
Typst
38 lines
2.1 KiB
Typst
#import "../requirements.typ": isc-hei-bthesis
|
|
#import isc-hei-bthesis: todo
|
|
#import "../utils.typ": include-offset
|
|
#import "@preview/acrostiche:0.7.0": acr
|
|
#import "@preview/gentle-clues:1.3.1" as gc
|
|
#import "../../meta.typ"
|
|
|
|
= 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 #acr("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.
|
|
|
|
#gc.info[
|
|
This chapter contains many references to the project's source code, which is available in the repository at #link(meta.project-repos).\
|
|
Additionally, a mirror is also available on GitHub at #link(meta.mirror-repo).
|
|
]
|
|
|
|
#pagebreak()
|
|
|
|
#include-offset(path("04_implementation/01_overview.typ"))
|
|
#include-offset(path("04_implementation/02_types_registry.typ"))
|
|
#include-offset(path("04_implementation/03_midas_language.typ"))
|
|
#include-offset(path("04_implementation/04_python_checking.typ"))
|
|
#include-offset(path("04_implementation/05_generation.typ"))
|
|
|
|
/*
|
|
Subjects:
|
|
- Variance inference
|
|
- Environment
|
|
- Resolver
|
|
- Evaluator
|
|
- CallDispatcher
|
|
- Registry (`is_subtype`)
|
|
- MethodRegistry (frames and columns)
|
|
*/ |