summaryrefslogtreecommitdiff
path: root/docs/type_system
diff options
context:
space:
mode:
authornodist <kevin.comas.git@gmail.com>2026-07-15 20:40:49 -0400
committernodist <kevin.comas.git@gmail.com>2026-07-15 20:40:49 -0400
commit224c245a875a6f28c01e93d037329c708ef81dd4 (patch)
tree7a368ccb80743651d5eb2f4b30a788ef70dae0ee /docs/type_system
parent4c008d258f6fd23fd64e2a6b059448748d7f7d24 (diff)
type var definitions
Diffstat (limited to 'docs/type_system')
-rw-r--r--docs/type_system/bit.md4
-rw-r--r--docs/type_system/function.md19
-rw-r--r--docs/type_system/list.md9
3 files changed, 27 insertions, 5 deletions
diff --git a/docs/type_system/bit.md b/docs/type_system/bit.md
index 26d5a98..b5ffed3 100644
--- a/docs/type_system/bit.md
+++ b/docs/type_system/bit.md
@@ -7,7 +7,7 @@ A sequence of bits that can fit into a general register
```text
SIZE_FLAGS : BIT_ANY | BIT8 | BIT16 | BIT32 | BIT64
-REPRESENTATION_FLAGS : INT | INT_UNSIGNED | INT_SIGNED | FLOAT |
+REPRESENTATION_FLAGS : NUMBER | INT | INT_UNSIGNED | INT_SIGNED | FLOAT |
UTF8 | UTF16 | UTF32 |
BOOL |
TYPE
@@ -28,6 +28,8 @@ typedef struct {
# Alias
```text
+Number `alias Bit[[BIT_ANY | NUMBER]]
+
Int `alias Bit[[BIT_ANY | INT]]
Int_unsiged `alias Bit[[BIT_ANY | INT_UNSIGNED]]
diff --git a/docs/type_system/function.md b/docs/type_system/function.md
index 129411c..1099a55 100644
--- a/docs/type_system/function.md
+++ b/docs/type_system/function.md
@@ -7,15 +7,16 @@ STATELESS : NATIVE | NATIVE_INLINE | PROCESS | GENERATOR | REGEX_GENERATOR
STATEFUL : TASK | ITERATOR | CLOSURE | BOUND | REGEX
-Function[[MODE | STATELESS | STATEFUL]; JIT; IR; Body; RETURN_TYPE; Collection[NAME_LIST; TYPE.SYMBOL]]
+Function[[MODE | STATELESS | STATEFUL]; counters; JIT; IR; Body; Parent_Fn; RETURN_TYPE; Collection[NAME_LIST; TYPE.SYMBOL]]
```
## Type Body Object Definitions
```c
typedef struct {
+ int8_t process_state_id_counter, general_register_id_counter, xmm_register_id_counter, locals_counter;
void *jit;
- kpl_type *ir, *body, *return_type, *var_list;
+ kpl_type *ir, *body, *parent_function, *return_type, *var_list;
} kpl_type_body_function;
```
@@ -32,6 +33,18 @@ Fn[Generic.T; Collection[VAR_TREE_LIST; TYPE.SYMBOL]] `alias Function[...]
([I64; I64.x; I64.y] x + y) // Fn[I64; I64.x; I64.y]
```
+# Casting To Functions
+
+```text
+body : (x + y)
+add_i64 : Fn[I64; I64.x; I64.y] $ body
+add_f64 : Fn[F64.x; F64.y] $ body // return type is inferred
+```
+
+### Copy By Cast
+
+Casting a list to a function requires a copy of the list made for type checking and evaluation, use inline definitions if the list is meant to be a single function
+
# Function Classes
## Native
@@ -142,4 +155,4 @@ fn `sync args // can be turned into `await fn `async args
# Type Inference
-The argument types of anonymous functions passed as an argument can be inhered
+The argument types of anonymous functions passed as an argument can be inferred
diff --git a/docs/type_system/list.md b/docs/type_system/list.md
index 22ad03c..38ffe74 100644
--- a/docs/type_system/list.md
+++ b/docs/type_system/list.md
@@ -3,7 +3,7 @@
---
```text
-List[[STATEMENT | DEFINE | ACTION | LOOP | IF | MATCH | MUTATION] PARENT; TARGET; ARG; LOOP; VAR_TREE; Collection[LIST; TYPE]]
+List[[STATEMENT | DEFINE | ACTION | LOOP | IF | MATCH | MUTATION] TARGET; DEFINED; NAMED; VAR_TREE; Collection[LIST; TYPE]]
```
## Type Body Object Definitions
@@ -13,3 +13,10 @@ typedef struct {
kpl_type *target, *defined, *named, *var_tree, *statement_list;
} kpl_type_body_list;
```
+
+## Lists As Variables
+
+```test
+list : (1; 2; 3)
+`log list // List $ (1; 2; 3)
+```