From cf9285b1dbdf687630076149413f16e5d4af82e8 Mon Sep 17 00:00:00 2001 From: nodist Date: Sun, 28 Jun 2026 13:41:22 -0400 Subject: type body object definitions and garbage collection algo --- docs/type_system/bit.md | 8 ++++++++ docs/type_system/buffer.md | 8 ++++++++ docs/type_system/error.md | 8 ++++++++ docs/type_system/function.md | 10 +++++++++- docs/type_system/group.md | 8 ++++++++ docs/type_system/list.md | 10 +++++++++- docs/type_system/lock.md | 8 ++++++++ docs/type_system/map.md | 8 ++++++++ docs/type_system/name.md | 11 ++++++++++- docs/type_system/namespace.md | 13 ++++++++++++- docs/type_system/native.md | 8 ++++++++ docs/type_system/op.md | 7 +++++++ docs/type_system/overload.md | 10 +++++++++- docs/type_system/queue.md | 8 ++++++++ docs/type_system/select.md | 8 ++++++++ docs/type_system/symbol.md | 11 ++++++++++- docs/type_system/task.md | 8 ++++++++ docs/type_system/union.md | 8 ++++++++ docs/type_system/value.md | 10 ++++++++++ docs/type_system/var.md | 4 ++-- 20 files changed, 166 insertions(+), 8 deletions(-) (limited to 'docs/type_system') diff --git a/docs/type_system/bit.md b/docs/type_system/bit.md index a5ba35f..ba11f30 100644 --- a/docs/type_system/bit.md +++ b/docs/type_system/bit.md @@ -14,6 +14,14 @@ REPRESENTATION_FLAGS : NUMERIC | INT | INT_UNSIGNED | INT_SIGNED | FLOAT | Bit[[SIZE_FLAGS | REPRESENTATION_FLAGS]] ``` +## Type Body Object Definitions + +```c +typedef struct { + // EMPTY +} kpl_type_body_bit; +``` + # Casting # Alias diff --git a/docs/type_system/buffer.md b/docs/type_system/buffer.md index 983fd4a..dca8ab9 100644 --- a/docs/type_system/buffer.md +++ b/docs/type_system/buffer.md @@ -8,6 +8,14 @@ An sequence of bytes with unknown size and a byte representation Buffer[[TYPE | UTF8 | UTF16 | UTF32] TYPE] ``` +## Type Body Object Definitions + +```c +typedef struct { + kpl_ptr type; +} kpl_type_body_buffer; +``` + # Alias ```text diff --git a/docs/type_system/error.md b/docs/type_system/error.md index bbf58c7..fbd15eb 100644 --- a/docs/type_system/error.md +++ b/docs/type_system/error.md @@ -8,6 +8,14 @@ An error for reporting, the data used to create it cannot be accessed Error[[]] ``` +## Type Body Object Definitions + +```c +typedef struct { + // EMPTY +} kpl_type_body_error; +``` + ## Example ```text diff --git a/docs/type_system/function.md b/docs/type_system/function.md index e2e2c4c..af17b74 100644 --- a/docs/type_system/function.md +++ b/docs/type_system/function.md @@ -11,7 +11,15 @@ STATEFUL : TASK | ITERATOR | CLOSURE | BOUND | REGEX FLAGS : INVOCATION | STATELESS | STATEFUL -Function[[FLAGS]; STATE; List; RETURN_TYPE; Collection[VAR_TREE_LIST; TYPE.SYMBOL]] +Function[[FLAGS]; Body; RETURN_TYPE; Collection[VAR_LIST; TYPE.SYMBOL]] +``` + +## Type Body Object Definitions + +```c +typedef struct { + kpl_ptr body, return_type, var_list; +} kpl_type_body_function; ``` # Alias diff --git a/docs/type_system/group.md b/docs/type_system/group.md index dcc3c0a..213e3e0 100644 --- a/docs/type_system/group.md +++ b/docs/type_system/group.md @@ -8,6 +8,14 @@ A sequence of different types accessed by index or a symbol mapped to an index Group[[INDEX | SYMBOL] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] ``` +## Type Body Object Definitions + +```c +typedef struct { + kpl_ptr var_tree, var_list; +} kpl_type_body_group; +``` + # Alias ```text diff --git a/docs/type_system/list.md b/docs/type_system/list.md index 0c90515..cbd7f84 100644 --- a/docs/type_system/list.md +++ b/docs/type_system/list.md @@ -3,5 +3,13 @@ --- ```text -List[[ROOT | STATEMENT | DEFINE | ACTION | LOOP | IF | MATCH | MUTATION] Parent; VAR_TREE_LIST; TARGET; STATEMENTS ...] +List[[ROOT | STATEMENT | DEFINE | ACTION | LOOP | IF | MATCH | MUTATION] PARENT; TARGET; VAR_TREE; Collection[LIST; TYPE]] +``` + +## Type Body Object Definitions + +```c +typedef struct { + kpl_ptr parent, target, var_tree, statement_list; +} kpl_type_body_list; ``` diff --git a/docs/type_system/lock.md b/docs/type_system/lock.md index 3b7d90a..d03dbfa 100644 --- a/docs/type_system/lock.md +++ b/docs/type_system/lock.md @@ -6,4 +6,12 @@ Lock[[] TARGET] ``` +## Type Body Object Definitions + +```c +typedef struct { + kpl_ptr target; +} kpl_type_body_lock; +``` + Prevent access to `TARGET` until a mutation occurs diff --git a/docs/type_system/map.md b/docs/type_system/map.md index 68b0464..44cd6cf 100644 --- a/docs/type_system/map.md +++ b/docs/type_system/map.md @@ -6,6 +6,14 @@ Map[[] KEY_TYPE; VALUE_TYPE] ``` +## Type Body Object Definitions + +```c +typedef struct { + kpl_ptr key, value; +} kpl_type_body_map; +``` + # Alias ```text diff --git a/docs/type_system/name.md b/docs/type_system/name.md index 27bb784..1f0c332 100644 --- a/docs/type_system/name.md +++ b/docs/type_system/name.md @@ -3,5 +3,14 @@ --- ```text -Name[[UNKNOWN | IS_TYPE | ALIAS_TYPE | UNIQUE_TYPE] TYPE; IDENTIFIER] +Name[[UNKNOWN | DATA_TYPE | ALIAS_TYPE | UNIQUE_TYPE] TYPE; IDENTIFIER] +``` + +## Type Body Object Definitions + +```c +typedef struct { + kpl_ptr type; + kpl_interface identifier; +} kpl_type_body_name; ``` diff --git a/docs/type_system/namespace.md b/docs/type_system/namespace.md index 8e300b9..d3a43db 100644 --- a/docs/type_system/namespace.md +++ b/docs/type_system/namespace.md @@ -3,7 +3,18 @@ --- ```text -Namespace[[NATIVE | MODULE] NAMESPACE_IDENTIFIER] +Namespace[[NATIVE | MODULE | MAIN] NAMESPACE_POINTER] +``` + +## Type Body Object Definitions + +```c +typedef struct { + union { + kpl_namespace_native *native; + kpl_namespace_module *module; + } namespace; +} kpl_type_body_namespace; ``` ## Exports diff --git a/docs/type_system/native.md b/docs/type_system/native.md index 875314f..db34181 100644 --- a/docs/type_system/native.md +++ b/docs/type_system/native.md @@ -8,6 +8,14 @@ A representation of a native object Native[[] INTERFACE_TABLE_POINTER] ``` +## Type Body Object Definitions + +```c +typdef struct { + kpl_interface *interface; +} kpl_type_body_native; +``` + ## Alias ```text diff --git a/docs/type_system/op.md b/docs/type_system/op.md index 198d73f..79f0953 100644 --- a/docs/type_system/op.md +++ b/docs/type_system/op.md @@ -5,5 +5,12 @@ ```text Op[[OP_NAME] RETURN_TYPE; LEFT_TYPE; RIGHT_TYPE] ``` +## Type Body Object Definitions + +```c +typedef struct { + kpl_ptr return_type, statement_left, statement_right; +} kpl_type_body_op; +``` The `OP_NAME` a single value diff --git a/docs/type_system/overload.md b/docs/type_system/overload.md index fc60602..bc083e2 100644 --- a/docs/type_system/overload.md +++ b/docs/type_system/overload.md @@ -5,7 +5,15 @@ List of complete functions, selected by signature ```text -Overload[[] Collection[VAR_TREE_LIST; Function[]]] +Overload[[] Collection[VAR_LIST; Function[]]] +``` + +## Type Body Object Definitions + +```c +typedef struct { + kpl_ptr var_list; +} kpl_type_body_overload; ``` ## Example diff --git a/docs/type_system/queue.md b/docs/type_system/queue.md index 0a15d36..3b17512 100644 --- a/docs/type_system/queue.md +++ b/docs/type_system/queue.md @@ -6,6 +6,14 @@ Queue[[] TYPE] ``` +## Type Body Object Definitions + +```c +typedef struct { + kpl_ptr type; +} kpl_type_body_queue; +``` + # Operators ## ``length` diff --git a/docs/type_system/select.md b/docs/type_system/select.md index 5cee24a..4ef3bbb 100644 --- a/docs/type_system/select.md +++ b/docs/type_system/select.md @@ -8,6 +8,14 @@ A symbol associated with a type Select[[SINGLE | MULTIPLE] Type; Collection[VAR_TREE_LIST; .symbol : %const Value]] ``` +## Type Body Object Definitions + +```c +typedef struct { + kpl_ptr type, var_tree, var_list; +} kpl_type_body_select; +``` + # Alias ```text diff --git a/docs/type_system/symbol.md b/docs/type_system/symbol.md index 3ce926e..ae5595f 100644 --- a/docs/type_system/symbol.md +++ b/docs/type_system/symbol.md @@ -3,5 +3,14 @@ --- ```text -Symbol[[] TARGET; TYPE; IDENTIFIER] +Symbol[[] TYPE; TARGET; IDENTIFIER] +``` + +## Type Body Object Definitions + +```c +typedef struct { + kpl_ptr type, target; + kpl_identifier identifier; +} kpl_type_body_symbol; ``` diff --git a/docs/type_system/task.md b/docs/type_system/task.md index 2cb0a4d..3561737 100644 --- a/docs/type_system/task.md +++ b/docs/type_system/task.md @@ -8,4 +8,12 @@ A segment of code assigned to a process, task code can be recursive Task[[] TYPE] ``` +## Type Body Object Definitions + +```c +typedef struct { + kpl_ptr type; +} kpl_type_body_task; +``` + ## \`await diff --git a/docs/type_system/union.md b/docs/type_system/union.md index 334c443..adaed4e 100644 --- a/docs/type_system/union.md +++ b/docs/type_system/union.md @@ -6,6 +6,14 @@ Union[CONTAINER | TRANSIENT] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] ``` +## Type Body Object Definitions + +```c +typedef struct { + kpl_ptr var_tree, var_list; +} kpl_type_body_union; +``` + # Alias ```text diff --git a/docs/type_system/value.md b/docs/type_system/value.md index d2e23d1..19b150a 100644 --- a/docs/type_system/value.md +++ b/docs/type_system/value.md @@ -5,3 +5,13 @@ ```text Value[[] TYPE; ID; KPL_CLASS] ``` + +## Type Body Object Definitions + +```c +typedef struct { + kpl_ptr type; + int32_t id; + kpl_class *class; +} kpl_type_body_value; +``` diff --git a/docs/type_system/var.md b/docs/type_system/var.md index 4e14e1f..1a5119f 100644 --- a/docs/type_system/var.md +++ b/docs/type_system/var.md @@ -10,8 +10,8 @@ Var[[SYMBOL | SCOPE | ARG | LOCAL | LOOP | IF | MATCH | MUTATE] TYPE; LEFT_VAR; ```c typedef struct { - kpl_ptr type, left, right; + kpl_ptr type, tree_left, tree_right; uint32_t tree_weight; kpl_identifier identifier; -} type_var_body; +} kpl_type_body_var; ``` -- cgit v1.2.3