7.0.0.6
13 Types and Type Checking
Goals |
— |
— |
— |
— |
Here is a link to the morning lecture slides (also available in PDF).
Recall our running (untyped) example language:
Definition | = | (define-function (Variable Variable ...) Expression) | ||
Expression | = | (function-application Variable Expression ...) | ||
| | (if Expression Expression Expression) | |||
| | (+ Expression Expression) | |||
| | Variable | |||
| | Number | |||
| | Boolean | |||
| | String |
We convert it to a typed language by:
Adjusting our language to accommodate the types:
Definition = (define-function (Variable [Variable : Type] ...) : Type Expression) Expression = (function-application Expression Expression ...) | (λ ([x : Type] ...) Expression) | (if Expression Expression Expression) | (+ Expression Expression) | Variable | Number | Boolean | String To simplify implementation of a type checker, we have added a λ expression in addition to define-function.
- Coming up with a language of types. For example:
Type = (-> Type ...) | Number | Boolean | String Developing type rules for our type system.
Implementing a type checker for our type rules.