diff --git a/compiler/chapter_8.md b/compiler/chapter_8.md index 3dda944..e96bdd8 100644 --- a/compiler/chapter_8.md +++ b/compiler/chapter_8.md @@ -1,13 +1,13 @@ -# Types +# 8 Types We'd like to be able to compile to a relatively low level. To this end, we need to have predetermined the types of the values used in the program code. -## Explicit types +## 8.1 Explicit types For a type checker to be able to determine all the types of all values, the program is required to contain the information need. That information will be dictated by the programmer, therefore the programmer needs a way to write types explicitly. We'll do this by adding types to the language. -### Syntax +### 8.1.1 Syntax We'll need explicit typing for the following types: null, int, string, bool, array, struct and function. @@ -29,13 +29,13 @@ let values: [int] = array(); -### Parsing parameters +### 8.1.2 Parsing parameters Both function definitions and let-statements use parameters. -### Parsing functions +### 8.1.3 Parsing functions -## Types in AST +## 8.2 Types in AST ```ts type Expr = {