aboutsummaryrefslogtreecommitdiff
path: root/doc/type_system.txt
blob: 53aeb78fde4d1d8bfcecb7572418cc61b8e7f82a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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