In this first lecture we have looked at mechanising the syntax and static semantic for imperative languages. Dependent types are cool and support embedding of language’s type-system directly within the term representation itself.
We have seen how to:
- encode well-typed expressions, statements, and methods;
- ensure that references are well-typed;
- ensure that statements are well-formed;
- ensured method calls are correct;
- have efficient encoding of nameless variable references;
What we have not seen, yet, is how to ensure that our type-system leads to type-safe programs nor that our language can be typed.
Lecture 2 will look at ensuring our programs are type-safe. Lecture 3 will ensure that our programs are typable.
Realising Olaf.
By following the exercises you will have the core terms for realising Ola the subset of Olaf we can explain in the lecture.
You can use this knowledge to start realising Olaf/Ola in the project stub provided with this course.
Namely you will be working in the module Olaf.Terms.
Many of the extra data structures,
AtIndex and Var and All,
are already in Idris standard libraries or provided within Olaf in the module hierarchy Extra.
Where Next with Intrinsically-Typed Terms;
We have only touched the surface of what intrinsically-typed representations can encode. Future work will be to look at, in order of difficulty:
- how we can type data structures such as arrays, lists, sums, products, tuples, records, and variants;
- intrinsically-typed pattern matching i.e. elimination of sums and variants;
- polymorphic type systems that help generic programming;
- encoding substructural type systems that look at how variables are used;
- object oriented programming i.e. classes;
There is, however, much more to look at.