diff options
author | Himbeer <himbeer@disroot.org> | 2024-09-05 14:58:41 +0200 |
---|---|---|
committer | Himbeer <himbeer@disroot.org> | 2024-09-05 14:58:41 +0200 |
commit | 05c620c4d637b73f6b267ed57d5750587ccfd7a3 (patch) | |
tree | 02500e22462c82aa0226907b1e4961215d5b1edb /doc/type_system.txt | |
parent | f5b38b07c632aea3eff8a82edb838b88eb1aed28 (diff) |
Move the documentation to a separate directory
Diffstat (limited to 'doc/type_system.txt')
-rw-r--r-- | doc/type_system.txt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/doc/type_system.txt b/doc/type_system.txt new file mode 100644 index 0000000..53aeb78 --- /dev/null +++ b/doc/type_system.txt @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: 2024 Himbeer <himbeer@disroot.org> +// +// SPDX-License-Identifier: CC-BY-NC-SA-4.0 + +- 1. Primitive types +-------------------- + + * int8, uint8 -> QBE b, w + * int16, uint16 -> QBE h, w + * int32, uint32 -> QBE w, w + * int64, uint64 -> QBE l, l + +- 2. Coercion +------------- + + * Integer widening + +- 3. Declaration and mutability +------------------------------- + + * Variables need to be declared before being used + * All declarations (including globals and implicit declarations from imports) + must be above their first use + * Redeclarations ("shadowing") are forbidden + * Variables may be changed using the "assign" statement + * Constants cannot be changed, but mutables can + * Local mutables are allocated on the stack, local constants are QBE + temporaries |