From bb912b081ed339e4a5419bd3d2ffd7465f2f72d3 Mon Sep 17 00:00:00 2001 From: nodist Date: Mon, 27 Jul 2026 17:17:56 -0400 Subject: bottom up redesign --- docs/type_system/alias.md | 7 -- docs/type_system/bit.md | 134 ----------------------------------- docs/type_system/buffer.md | 74 -------------------- docs/type_system/const.md | 9 --- docs/type_system/empty.md | 27 -------- docs/type_system/error.md | 23 ------ docs/type_system/function.md | 158 ------------------------------------------ docs/type_system/generic.md | 33 --------- docs/type_system/group.md | 46 ------------ docs/type_system/index.md | 119 ------------------------------- docs/type_system/ir.md | 22 ------ docs/type_system/list.md | 22 ------ docs/type_system/lock.md | 17 ----- docs/type_system/map.md | 36 ---------- docs/type_system/name.md | 16 ----- docs/type_system/namespace.md | 57 --------------- docs/type_system/native.md | 23 ------ docs/type_system/op.md | 21 ------ docs/type_system/overload.md | 27 -------- docs/type_system/queue.md | 37 ---------- docs/type_system/ref.md | 9 --- docs/type_system/select.md | 32 --------- docs/type_system/shared.md | 43 ------------ docs/type_system/symbol.md | 16 ----- docs/type_system/task.md | 20 ------ docs/type_system/union.md | 72 ------------------- docs/type_system/unique.md | 21 ------ docs/type_system/value.md | 16 ----- docs/type_system/var.md | 24 ------- 29 files changed, 1161 deletions(-) delete mode 100644 docs/type_system/alias.md delete mode 100644 docs/type_system/bit.md delete mode 100644 docs/type_system/buffer.md delete mode 100644 docs/type_system/const.md delete mode 100644 docs/type_system/empty.md delete mode 100644 docs/type_system/error.md delete mode 100644 docs/type_system/function.md delete mode 100644 docs/type_system/generic.md delete mode 100644 docs/type_system/group.md delete mode 100644 docs/type_system/index.md delete mode 100644 docs/type_system/ir.md delete mode 100644 docs/type_system/list.md delete mode 100644 docs/type_system/lock.md delete mode 100644 docs/type_system/map.md delete mode 100644 docs/type_system/name.md delete mode 100644 docs/type_system/namespace.md delete mode 100644 docs/type_system/native.md delete mode 100644 docs/type_system/op.md delete mode 100644 docs/type_system/overload.md delete mode 100644 docs/type_system/queue.md delete mode 100644 docs/type_system/ref.md delete mode 100644 docs/type_system/select.md delete mode 100644 docs/type_system/shared.md delete mode 100644 docs/type_system/symbol.md delete mode 100644 docs/type_system/task.md delete mode 100644 docs/type_system/union.md delete mode 100644 docs/type_system/unique.md delete mode 100644 docs/type_system/value.md delete mode 100644 docs/type_system/var.md (limited to 'docs/type_system') diff --git a/docs/type_system/alias.md b/docs/type_system/alias.md deleted file mode 100644 index c98722b..0000000 --- a/docs/type_system/alias.md +++ /dev/null @@ -1,7 +0,0 @@ -# Alias - ---- - -A type based on a complete template that is interchangeable with what it is based on - -## \`alias diff --git a/docs/type_system/bit.md b/docs/type_system/bit.md deleted file mode 100644 index b5ffed3..0000000 --- a/docs/type_system/bit.md +++ /dev/null @@ -1,134 +0,0 @@ -# Bit - ---- - -A sequence of bits that can fit into a general register - -```text -SIZE_FLAGS : BIT_ANY | BIT8 | BIT16 | BIT32 | BIT64 - -REPRESENTATION_FLAGS : NUMBER | INT | INT_UNSIGNED | INT_SIGNED | FLOAT | - UTF8 | UTF16 | UTF32 | - BOOL | - TYPE - -Bit[[SIZE_FLAGS | REPRESENTATION_FLAGS]] -``` - -## Type Body Object Definitions - -```c -typedef struct { - kpl_interface *interface; -} kpl_type_body_bit; -``` - -# Casting - -# Alias - -```text -Number `alias Bit[[BIT_ANY | NUMBER]] - -Int `alias Bit[[BIT_ANY | INT]] - -Int_unsiged `alias Bit[[BIT_ANY | INT_UNSIGNED]] - -U8 `alias Bit[[BIT8 | INT_UNSIGNED]] -U16 `alias Bit[[BIT16 | INT_UNSIGNED]] -U32 `alias Bit[[BIT32 | INT_UNSIGNED]] -U64 `alias Bit[[BIT64 | INT_UNSIGED]] - -Int_signed `alias Bit[[BIT_ANY | INT_SIGNED]] - -I8 `alias Bit[[BIT8 | INT_SIGNED]] -I16 `alias Bit[[BIT16 | INT_SIGNED]] -I32 `alias Bit[[BIT32 | INT_SIGNED]] -I64 `alias Bit[[BIT64 | INT_SIGNED]] - -Float `alias Bit[[BIT_ANY | FLOAT]] - -F32 `alias Bit[[BIT32 | FLOAT]] -F64 `alias Bit[[BIT64 | FLOAT]] - -Char `alias Bit[[BIT32 | UTF8]] - -Bool `alias Bit[[BIT8 | BOOL]] - -Type `alias Bit[[BIT64 | TYPE]] -``` - -# Operators - -## Arithmetic - -### Add `+` - -### Sub `-` - -### Mul `*` - -### Div `/` - -### ``mod` - -### ``exp` - -### ``ln` - -## Boolean - -### ``true` - -### ``false` - -### Not `!` - -### Equal `=` - -### Not Equal `!=` - -### And `&` - -### Or `|` - -### Greater `>` - -### Greater Equal `>=` - -### Less `<` - -### Less Equal `<=` - -## Bitwise - -### ``bit_not` - -### ``bit_and` - -### ``bit_or` - -### ``bit_xor` - -### ``bit_ls` - -### ``bit_rs` - -## Other - -### Compare `<=>` - -```c -typedef ssize_t kpl_interface_compare(const kpl_any any_a, const kpl_any any_b); -``` - -# Char - -```text -c : 'Σ' -`log c // Char $ 'Σ' -``` - -# Type - -KPL Types as values diff --git a/docs/type_system/buffer.md b/docs/type_system/buffer.md deleted file mode 100644 index d38dd88..0000000 --- a/docs/type_system/buffer.md +++ /dev/null @@ -1,74 +0,0 @@ -# Buffer - ---- - -An sequence of bytes with unknown size and a byte representation - -```text -Buffer[[TYPE | UTF8 | UTF16 | UTF32] TYPE] -``` - -## Type Body Object Definitions - -```c -typedef struct { - kpl_interface *interface; -} kpl_type_body_buffer; -``` - -# Alias - -```text -String `alias Buffer[[UTF8] Void] - -Array[Generic.T] `alias Buffer[[TYPE] Generic.T] -``` - -# Operators - -## Symbol Access - -## ``get` - -## ``set` - -## ``length` - -## ``push` - -## ``pop` - -## ``reverse` - -## ``join` - -## ``split` - -## ``array` - -```text -array : SIZE `array ([U64.index] index) -``` - -## ``map` - -## ``each` - -In place map - -## ``filter` - -## ``reduce` - -## Concatenate `,` - -# Iterating - -# Mutating - -# Strings - -```text -s : "asdf" -`log s String $ "asdf" -``` diff --git a/docs/type_system/const.md b/docs/type_system/const.md deleted file mode 100644 index 3966009..0000000 --- a/docs/type_system/const.md +++ /dev/null @@ -1,9 +0,0 @@ -# Const - ---- - -Cannot be changed or mutated - -```text -%const -``` diff --git a/docs/type_system/empty.md b/docs/type_system/empty.md deleted file mode 100644 index 9466493..0000000 --- a/docs/type_system/empty.md +++ /dev/null @@ -1,27 +0,0 @@ -# Empty - ---- - -Container type can be null - -```text -%empty -``` - -## Use with `Result` Union - -```text -make_array : ([Bool.yes] - ? yes { - `value Array $ (1; 2; 3) - `null - } -) -v : make_array(...) // %empty Array[I64] $ .null OR %empty Array[I64] $ (.value : (1; 2; 3)) -# v { - .value {[x] `log x } // Array[I64] $ (1; 2; 3) - .null { ... } -} -// same as above -? v {[x] `log x } // Array[I64] $ (1; 2; 3) -``` diff --git a/docs/type_system/error.md b/docs/type_system/error.md deleted file mode 100644 index 7931e0e..0000000 --- a/docs/type_system/error.md +++ /dev/null @@ -1,23 +0,0 @@ -# Error - ---- - -An error for reporting, the data used to create it cannot be accessed - -```text -Error[[]] -``` - -## Type Body Object Definitions - -```c -typedef struct { - kpl_interface *interface; -} kpl_type_body_error; -``` - -## Example - -```text -e : Error $ "This is an error" -``` diff --git a/docs/type_system/function.md b/docs/type_system/function.md deleted file mode 100644 index 1099a55..0000000 --- a/docs/type_system/function.md +++ /dev/null @@ -1,158 +0,0 @@ -# Function - ---- - -```text -STATELESS : NATIVE | NATIVE_INLINE | PROCESS | GENERATOR | REGEX_GENERATOR - -STATEFUL : TASK | ITERATOR | CLOSURE | BOUND | REGEX - -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, *parent_function, *return_type, *var_list; -} kpl_type_body_function; -``` - -# Alias - -```text -Fn[Generic.T; Collection[VAR_TREE_LIST; TYPE.SYMBOL]] `alias Function[...] -``` - -# Inline Definition - -```text -([I64.x; I64.y] x + y) // Fn[Any; I64.x; I64.y] -([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 - -Native C code that can be called async - -## Native Inline - -Native C code that cannot be called async, has to be inline - -## Task - -A queue-able function in a process or iterator - -## Process - -A list of tasks with state - -## Generator - -A function for creating an iterator - -## Regex Generator - -A function for creating Regular Expression matcher - -## Iterator - -A task creator with state, cannot take arguments, can be called until done - -## Closure - -A task creator with state that can take arguments - -## Bound - -A function with some arguments already set - -## Regex - -Invoked regular expression matcher - -# Returning - -## Return Type Inference - -If a return type is not specified it is inferred a type checking time - -## \`return - -The return operation type is Void with the `%return` qualifier - -```text -%return Void -``` -This qualifier is used when type checking branches that should return value, indicating this branch is valid - -## Transient Union Return Chaining - -# Iterating - -## \`yield - -Yielding wraps the value in the transient union `Iteration` - -Return `Void` to stop iteration - -```text -fn : ([I64.n] @ 1 < n {[x] `yield 2 * x; n +: 1 } ) -it : fn `sync 10 -// invoking -@ it {[v] `log v } // 2 4 6 8 10 12 14 16 18 20 -// same as above -@ { - # `sync it { - .value {[v] `log v } - .done { `break } - } -} -``` - -## Range `..` - -# Calling - -## \`async - -Asynchronous call - -```text -task : `async fn -value : `await task -``` - -## \`sync - -Synchronous call - -If the callee is a process, an inline await with async is used - -```text -fn `sync args // can be turned into `await fn `async args -``` - -# Binding - -## \`bind - -# Type Inference - -The argument types of anonymous functions passed as an argument can be inferred diff --git a/docs/type_system/generic.md b/docs/type_system/generic.md deleted file mode 100644 index e028788..0000000 --- a/docs/type_system/generic.md +++ /dev/null @@ -1,33 +0,0 @@ -# Generic - ---- - -```text -Generic[[TYPE | SYMBOL] TARGET; Collection[VAR_TREE_LIST; TYPE.SYMBOL]] -``` - -## Type Body Object Definitions - -```c -typedef struct { - kpl_type *target, *var_tree, *var_list; - kpl_identifier identifier; -} kpl_type_body_generic; -``` - -# Example - -```text -ints : Set[I64] $ () -/* -ints -> Name[[DATA] Var[[LOCAL] Generic[[TYPE] REF_SET; Var[[GENERIC] REF_I64; T]; ints]; ints] -REF_SET -> Name[[ALIAS] Map[Generic[[SYMBOL] T]; Void]; Set] -REF_I64 -> Name[[Alias] Bit[[BIT64 | INT_SIGNED]]; I64] -*/ -floats : Array[F64] $ () -/* -floats -> Name[[DATA] Var[[LOCAL] Generic[[TYPE] REF_ARRAY; Var[[GENERIC] REF_F64; T]; floats]; floats] -REF_ARRAY -> Name[[ALIAS] Buffer[[TYPE] Generic[[SYMBOL]; T]; Array] -REF_F64 -> Name[[Alias] Bit[BIT64 | FLOAT]; F64] -*/ -``` diff --git a/docs/type_system/group.md b/docs/type_system/group.md deleted file mode 100644 index 48781af..0000000 --- a/docs/type_system/group.md +++ /dev/null @@ -1,46 +0,0 @@ -# Group - ---- - -A sequence of different types accessed by index or a symbol mapped to an index - -```text -Group[[TUPLE | TABLE] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] -``` - -## Type Body Object Definitions - -```c -typedef struct { - kpl_type *var_tree, *var_list; -} kpl_type_body_group; -``` - -# Alias - -```text -Tuple `definition Group[[TUPLE] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] - -Table `definition Group[[TABLE] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] -``` - -# Operators - -## Symbol Access - -## ``get` - -## ``set` - -```text -Result[Void] : target `set (KEY; VALUE) - -items : Tuple $ (1; 2; 3) -items `set (0; 4) -// ^ items.0 {[i] i : 4 } -`log items // Tuple[I64; I64; I64] $ (4; 2; 3) -``` - -# Destructuring - -# Mutating diff --git a/docs/type_system/index.md b/docs/type_system/index.md deleted file mode 100644 index 65c21d8..0000000 --- a/docs/type_system/index.md +++ /dev/null @@ -1,119 +0,0 @@ -# Types - -* #### [Alias](./alias.md) - -* #### [Unique](./unique.md) - ---- - -# Representation - -```text -TEMPLATE[[MODIFIERS] DEFINES...;...] -``` - -## Modifiers - -A modifier is an internal setting (a bit mask or single value), cannot be set by a user - -Each template below has its own modifiers - -## Defines - -User specified - -# Templates - -A template is an incomplete type - -```text -Template[[] Field; ...] -``` - -If a field in a template is not filed, one of these are required: - -## Any - -Denotes a field in a template that has not resolved - -A template by name only expands to all inner fields as `Any` - -## Generic.SYMBOL - -A field that is substituted with a `Generic` type - -## Collection[STORAGE; TYPE] - -A list of types with shape of TYPE, only can have one collection per type - -The collection is stored internally as STORAGE - -If using a collection the Collection[TYPE] must be the last type on the templates type list - -## Void - -Denotes that a field that does not resolve to anything - -## Meta Templates - -* #### [Var](./var.md) - -* #### [Generic](./generic.md) - -## Value Templates - -* #### [Select](./select.md) - -* #### [Bit](./bit.md) - -## Container Templates - -* #### [Group](./group.md) - -* #### [Buffer](./buffer.md) - -* #### [Map](./map.md) - -* #### [Queue](./queue.md) - -* #### [Union](./union.md) - -* #### [Native](./native.md) - -* #### [Error](./error.md) - -## Qualifier Templates - -* #### [Const](./const.md) - -* #### [Empty](./empty.md) - -* #### [Ref](./ref.md) - -* #### [Shared](./shared.md) - -## Function Templates - -* #### [Function](./function.md) - -* #### [Task](./task.md) - -* #### [Overload](./overload.md) - -## AST Templates - -* #### [Value](./value.md) - -* #### [Name](./name.md) - -* #### [Symbol](./symbol.md) - -* #### [Op](./op.md) - -* #### [List](./list.md) - -* #### [Lock](./lock.md) - -* #### [Namespace](./namespace.md) - -* #### [Ir](./ir.md) diff --git a/docs/type_system/ir.md b/docs/type_system/ir.md deleted file mode 100644 index 9ebfd79..0000000 --- a/docs/type_system/ir.md +++ /dev/null @@ -1,22 +0,0 @@ -# Ir - ---- - -```text -Ir[[IR_NAME] Address[6]] -``` - -`IR_NAME` is a single value - -## Type Body Object Definitions - -```c -typedef struct { - ssize_t label; - kpl_type *address[6]; -} kpl_type_body_ir; - -typedef enum : uint16_t { - -} kpl_ir_name; -``` diff --git a/docs/type_system/list.md b/docs/type_system/list.md deleted file mode 100644 index 958bcfb..0000000 --- a/docs/type_system/list.md +++ /dev/null @@ -1,22 +0,0 @@ -# List - ---- - -```text -List[[STATEMENT | DEFINE | ACTION | LOOP | IF | MATCH | MUTATION] TARGET; DEFINED; NAMED; LIST; FUNCTION; VAR_TREE; Collection[LIST; TYPE]] -``` - -## Type Body Object Definitions - -```c -typedef struct { - kpl_type *target, *defined, *named, *list, *function; *var_tree, *statement_list; -} kpl_type_body_list; -``` - -## Lists As Variables - -```test -list : (1; 2; 3) -`log list // List $ (1; 2; 3) -``` diff --git a/docs/type_system/lock.md b/docs/type_system/lock.md deleted file mode 100644 index 151c1aa..0000000 --- a/docs/type_system/lock.md +++ /dev/null @@ -1,17 +0,0 @@ -# Lock - ---- - -```text -Lock[[] TARGET] -``` - -## Type Body Object Definitions - -```c -typedef struct { - kpl_type *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 deleted file mode 100644 index adf227d..0000000 --- a/docs/type_system/map.md +++ /dev/null @@ -1,36 +0,0 @@ -# Map - ---- - -```text -Map[[] KEY_TYPE; VALUE_TYPE] -``` - -## Type Body Object Definitions - -```c -typedef struct { - kpl_type *key, *value; - kpl_interface *interface; -} kpl_type_body_map; -``` - -# Alias - -```text -Set[Generic.T] `alias Map[Generic.T; Void] -``` - -# Operators - -## ``get` - -## ``set` - -## ``has` - -## Concatenate `,` - -# Iterating - -# Mutating diff --git a/docs/type_system/name.md b/docs/type_system/name.md deleted file mode 100644 index eadda07..0000000 --- a/docs/type_system/name.md +++ /dev/null @@ -1,16 +0,0 @@ -# Name - ---- - -```text -Name[[DATA | ALIAS | UNIQUE] TYPE; IDENTIFIER] -``` - -## Type Body Object Definitions - -```c -typedef struct { - kpl_type *type; - kpl_interface identifier; -} kpl_type_body_name; -``` diff --git a/docs/type_system/namespace.md b/docs/type_system/namespace.md deleted file mode 100644 index d3a43db..0000000 --- a/docs/type_system/namespace.md +++ /dev/null @@ -1,57 +0,0 @@ -# Namespace - ---- - -```text -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 - -### \`export - -#### Type must be Fn[STATELESS], Overload, Const, Shared or Namespace to export - -#### Re-exporting - -## Imports - -### \`import - -```text -namespace : `import Value[String] -``` - -All imports are relative to the importer - -### \`use - -```text -namespace : `use Value[String] -``` - -## Namespace destructuring - -```text -namespace : `use Value[String] -namespace[scope_name.namespace_name] -namespcae[name] // resolves to namespace[name.name] -`use Value[String] [name] -``` - -## Main - -### \`is_main - -Run this function if the module is not imported diff --git a/docs/type_system/native.md b/docs/type_system/native.md deleted file mode 100644 index db34181..0000000 --- a/docs/type_system/native.md +++ /dev/null @@ -1,23 +0,0 @@ -# Native - ---- - -A representation of a native object - -```text -Native[[] INTERFACE_TABLE_POINTER] -``` - -## Type Body Object Definitions - -```c -typdef struct { - kpl_interface *interface; -} kpl_type_body_native; -``` - -## Alias - -```text -File `alias Native[...] -``` diff --git a/docs/type_system/op.md b/docs/type_system/op.md deleted file mode 100644 index 868c41b..0000000 --- a/docs/type_system/op.md +++ /dev/null @@ -1,21 +0,0 @@ -# Op - ---- - -```text -Op[[OP_NAME] RETURN_TYPE; LEFT_TYPE; RIGHT_TYPE] -``` - -`OP_NAME` a single value - -## Type Body Object Definitions - -```c -typedef struct { - kpl_type *return_type, *statement_left, *statement_right; -} kpl_type_body_op; - -typedef enum : uint16_t { - -} kpl_op_name; -``` diff --git a/docs/type_system/overload.md b/docs/type_system/overload.md deleted file mode 100644 index 467d898..0000000 --- a/docs/type_system/overload.md +++ /dev/null @@ -1,27 +0,0 @@ -# Overload - ---- - -List of complete functions, selected by signature - -```text -Overload[[] Collection[VAR_LIST; Function[]]] -``` - -## Type Body Object Definitions - -```c -typedef struct { - kpl_type *var_list; -} kpl_type_body_overload; -``` - -## Example - -```text -add : Overload[Fn[I64; I64.x; I64.y]; Fn[F64; F64.x; F64.y]; ...] - -`log add `sync (1; 2) // Valid calls first -`log add `sync (1.1; 2.2) // Valid calls second -`log add `sync (1; 2.2) // Invalid no signature match -``` diff --git a/docs/type_system/queue.md b/docs/type_system/queue.md deleted file mode 100644 index 800aa43..0000000 --- a/docs/type_system/queue.md +++ /dev/null @@ -1,37 +0,0 @@ -# Queue - ---- - -```text -Queue[[] TYPE] -``` - -## Type Body Object Definitions - -```c -typedef struct { - kpl_interface *interface; -} kpl_type_body_queue; -``` - -# Operators - -## ``length` - -## ``get_head` - -## ``push_head` - -## ``pop_head` - -## ``get_tail` - -## ``push_tail` - -## ``pop_tail` - -## Concatenate `,` - -# Iterating - -# Mutating diff --git a/docs/type_system/ref.md b/docs/type_system/ref.md deleted file mode 100644 index 7eea6aa..0000000 --- a/docs/type_system/ref.md +++ /dev/null @@ -1,9 +0,0 @@ -# Ref - ---- - -```text -%ref -``` - -A reference, cannot be assigned diff --git a/docs/type_system/select.md b/docs/type_system/select.md deleted file mode 100644 index 31ad83c..0000000 --- a/docs/type_system/select.md +++ /dev/null @@ -1,32 +0,0 @@ -# Select - ---- - -A symbol associated with a type - -```text -Select[[ENUM | MASK] Type; Collection[VAR_TREE_LIST; .symbol : %const Value]] -``` - -## Type Body Object Definitions - -```c -typedef struct { - kpl_type *type, *var_tree, *var_list; -} kpl_type_body_select; -``` - -# Alias - -```text -Enum `definition Select[[ENUM]; TYPE; Collection[VAR_TREE_LIST; .symbol : %const Value]] - -Mask `definition Select[[MASK]; Void; Collection[VAR_TREE_LIST; .symbol]] -``` - -## Definition Example - -```text -e : Enum[I64; .a; .b; .c] -`log E // Select[[ENUM] I64; .a : 0; .b : 1; .c : 2] -``` diff --git a/docs/type_system/shared.md b/docs/type_system/shared.md deleted file mode 100644 index dcb31d5..0000000 --- a/docs/type_system/shared.md +++ /dev/null @@ -1,43 +0,0 @@ -# Shared - ---- - -Hold multiple references to the same object - -```text -%shared -``` - -# Garbage Collection - -A tracing mark and sweep garbage collector is used - -# Mutating - -```text -x : %shared Array $ (1; 2; 3) -^ x {[y] - y `push 4 -} -`log x // %shared Array[I64] $ (1; 2; 3; 4) -``` - -# Operators - -## ``get` - -## ``set` - -### Example sharing data between two shared objects - -```text -x : %shared 1 -y : %shared 0 - -z : ^ x {[x] x } -^ y {[y] y : z } -// same as above -y `set `get x -``` - - diff --git a/docs/type_system/symbol.md b/docs/type_system/symbol.md deleted file mode 100644 index da8faa7..0000000 --- a/docs/type_system/symbol.md +++ /dev/null @@ -1,16 +0,0 @@ -# Symbol - ---- - -```text -Symbol[[] TYPE; TARGET; IDENTIFIER] -``` - -## Type Body Object Definitions - -```c -typedef struct { - kpl_type *type, *target; - kpl_identifier identifier; -} kpl_type_body_symbol; -``` diff --git a/docs/type_system/task.md b/docs/type_system/task.md deleted file mode 100644 index 56d232c..0000000 --- a/docs/type_system/task.md +++ /dev/null @@ -1,20 +0,0 @@ -# Task - ---- - -A segment of code assigned to a process, task code can be recursive - -```text -Task[[] TYPE] -``` - -## Type Body Object Definitions - -```c -typedef struct { - kpl_type *type; - kpl_interface *interface; -} kpl_type_body_task; -``` - -## \`await diff --git a/docs/type_system/union.md b/docs/type_system/union.md deleted file mode 100644 index bf9f857..0000000 --- a/docs/type_system/union.md +++ /dev/null @@ -1,72 +0,0 @@ -# Union - ---- - -```text -Union[TAG | TRANSIENT] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] -``` - -## Type Body Object Definitions - -```c -typedef struct { - kpl_type *var_tree, *var_list; -} kpl_type_body_union; -``` - -# Alias - -```text -Tag `definition Union[[TAG] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] - -Transient `definition Union[[TRANSIENT] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] -``` - -## Tag Example - -```text -u : Tag[I64.a; I64.b; I64.c] $ (.c : 5) - -# u { - .c {[c] c ... } - { ... } // default -} -``` - -# Operators - -## ``take` - -# Transient Unions - -Return multiple types from a function - -Can only be retuned from functions and operations. The inner value must be moved out - -## Alias - -```text -Result[Generic.T] `alias Transient[Generic.T.value; Void.null; Error.error] - -Iteration[Generic.T] `alias Transient[Generic.T.value; Void.null; Void.done; Error.error] -``` - -## Default Operation - -When a transient union is assigned the first type specified is moved out. - -If no match is used and if the type is not the first specified a result with an error is returned - -```text -z : x / y // Result[...] -z // is value if y is not zero -``` -## Operators - -### \`value - -### \`error - -### \`null - -Can take a TYPE as a parameter diff --git a/docs/type_system/unique.md b/docs/type_system/unique.md deleted file mode 100644 index 30d0812..0000000 --- a/docs/type_system/unique.md +++ /dev/null @@ -1,21 +0,0 @@ -# Unique - ---- - -A type based on a complete template or an alias that is not interchangeable with what it is based on - -## \`unique - -# Example - -```text -Inches `unique U64 - -Centimeters `unique U64 - -i : Inches $ 1 - -c : Centimeters $ 1 - -i = c // Type Error -``` diff --git a/docs/type_system/value.md b/docs/type_system/value.md deleted file mode 100644 index 5f50794..0000000 --- a/docs/type_system/value.md +++ /dev/null @@ -1,16 +0,0 @@ -# Value - ---- - -```text -Value[[] TYPE; KPL_CLASS] -``` - -## Type Body Object Definitions - -```c -typedef struct { - kpl_type *type; - kpl_class *class; -} kpl_type_body_value; -``` diff --git a/docs/type_system/var.md b/docs/type_system/var.md deleted file mode 100644 index 4d88c5b..0000000 --- a/docs/type_system/var.md +++ /dev/null @@ -1,24 +0,0 @@ -# Var - ---- - -```text -Var[[GENERIC | ARG | LOCAL | LOOP | IF | MATCH | MUTATE] TYPE; LEFT_VAR; RIGHT_VAR; IDENTIFIER] -``` - -## Type Body Object Definition - -```c -typedef struct { - kpl_type *type, *tree_left, *tree_right; - kpl_identifier identifier; -} kpl_type_body_var; -``` - -## Function Vars - -Each var in a function belongs to a scope within that function - -```text -var -> list -> function -``` -- cgit v1.2.3