diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-07-16 17:50:07 -0400 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-07-16 17:50:07 -0400 |
| commit | e950f786e25967a222cfa7bce7327ffd458e8c95 (patch) | |
| tree | 8c0cc77ac43806b146a49f74db2332a6181a2515 /docs | |
| parent | 224c245a875a6f28c01e93d037329c708ef81dd4 (diff) | |
add generics
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/application/thread.md | 2 | ||||
| -rw-r--r-- | docs/application/type.md | 8 | ||||
| -rw-r--r-- | docs/lifecycle/scope.md | 8 | ||||
| -rw-r--r-- | docs/type_system/generic.md | 32 | ||||
| -rw-r--r-- | docs/type_system/group.md | 6 | ||||
| -rw-r--r-- | docs/type_system/index.md | 6 | ||||
| -rw-r--r-- | docs/type_system/list.md | 4 | ||||
| -rw-r--r-- | docs/type_system/name.md | 2 | ||||
| -rw-r--r-- | docs/type_system/select.md | 8 | ||||
| -rw-r--r-- | docs/type_system/union.md | 4 | ||||
| -rw-r--r-- | docs/type_system/var.md | 8 |
11 files changed, 68 insertions, 20 deletions
diff --git a/docs/application/thread.md b/docs/application/thread.md index c0ad199..91fa168 100644 --- a/docs/application/thread.md +++ b/docs/application/thread.md @@ -22,8 +22,6 @@ typedef struct _task { _Atomic bool join_ready; } task; -#define KPL_QUEUE_ASYNC -1 - #define KPL_MAIN_THREAD 0 typedef struct { diff --git a/docs/application/type.md b/docs/application/type.md index 3a831b2..796d848 100644 --- a/docs/application/type.md +++ b/docs/application/type.md @@ -47,11 +47,15 @@ typedef struct _kpl_type { kpl_native_id native_id; int8_t process_state_id; // -1 not used uint16_t tree_weight; - struct _kpl_type *function; + struct _kpl_type *list; } var; } meta; _Atomic ssize_t ref_count; - struct _kpl_type *prev, *next, *parent; + struct _kpl_type *prev, *next; kpl_type_body body; } kpl_type; ``` + +# Type Matching + +For type checking and evaluation diff --git a/docs/lifecycle/scope.md b/docs/lifecycle/scope.md index 1f4508b..68862bc 100644 --- a/docs/lifecycle/scope.md +++ b/docs/lifecycle/scope.md @@ -4,14 +4,18 @@ ## Initialize Functions +## Link Function Scopes + ## Create Vars ## Link Functions Parents -## Split Process Into Tasks by `await` - ## Initialize Actions +## Split Process Into Tasks by `await` + ## Register Imports On finding an import node add a register task for the imported string + +## Initialize Generics diff --git a/docs/type_system/generic.md b/docs/type_system/generic.md new file mode 100644 index 0000000..2b9a89f --- /dev/null +++ b/docs/type_system/generic.md @@ -0,0 +1,32 @@ +# 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_type_body_generic; +``` + +# Example + +```text +ints : Set[I64] $ () +/* +ints -> Name[[DATA] Var[[LOCAL] Generic[[TYPE] REF_SET; Symbol[Void; REF_I64; T]; ints]; ints] +REF_SET -> Name[[ALIAS] Map[Symbol[Void; 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; Symbol[Void; REF_F64; T]; floats]; floats] +REF_ARRAY -> Name[[ALIAS] Buffer[[TYPE] Symbol[Void; 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 index 0664276..48781af 100644 --- a/docs/type_system/group.md +++ b/docs/type_system/group.md @@ -5,7 +5,7 @@ A sequence of different types accessed by index or a symbol mapped to an index ```text -Group[[INDEX | SYMBOL] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] +Group[[TUPLE | TABLE] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] ``` ## Type Body Object Definitions @@ -19,9 +19,9 @@ typedef struct { # Alias ```text -Tuple[Collection[TYPE.SYMBOL]] `alias Group[[INDEX] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] +Tuple `definition Group[[TUPLE] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] -Table[Collection[TYPE.SYMBOL]] `alias Group[[SYMBOL] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] +Table `definition Group[[TABLE] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] ``` # Operators diff --git a/docs/type_system/index.md b/docs/type_system/index.md index 456be2f..65c21d8 100644 --- a/docs/type_system/index.md +++ b/docs/type_system/index.md @@ -40,7 +40,7 @@ A template by name only expands to all inner fields as `Any` ## Generic.SYMBOL -Generic for alias and unique types, type is replaced with type passed +A field that is substituted with a `Generic` type ## Collection[STORAGE; TYPE] @@ -54,10 +54,12 @@ If using a collection the Collection[TYPE] must be the last type on the template Denotes that a field that does not resolve to anything -## Identifier Templates +## Meta Templates * #### [Var](./var.md) +* #### [Generic](./generic.md) + ## Value Templates * #### [Select](./select.md) diff --git a/docs/type_system/list.md b/docs/type_system/list.md index 38ffe74..bce9361 100644 --- a/docs/type_system/list.md +++ b/docs/type_system/list.md @@ -3,14 +3,14 @@ --- ```text -List[[STATEMENT | DEFINE | ACTION | LOOP | IF | MATCH | MUTATION] TARGET; DEFINED; NAMED; VAR_TREE; Collection[LIST; TYPE]] +List[[STATEMENT | DEFINE | ACTION | LOOP | IF | MATCH | MUTATION] TARGET; DEFINED; NAMED; FUNCTION; VAR_TREE; Collection[LIST; TYPE]] ``` ## Type Body Object Definitions ```c typedef struct { - kpl_type *target, *defined, *named, *var_tree, *statement_list; + kpl_type *target, *defined, *named, *function; *var_tree, *statement_list; } kpl_type_body_list; ``` diff --git a/docs/type_system/name.md b/docs/type_system/name.md index b329521..eadda07 100644 --- a/docs/type_system/name.md +++ b/docs/type_system/name.md @@ -3,7 +3,7 @@ --- ```text -Name[[UNKNOWN | DATA_TYPE | ALIAS_TYPE | UNIQUE_TYPE] TYPE; IDENTIFIER] +Name[[DATA | ALIAS | UNIQUE] TYPE; IDENTIFIER] ``` ## Type Body Object Definitions diff --git a/docs/type_system/select.md b/docs/type_system/select.md index 85528e0..9218b56 100644 --- a/docs/type_system/select.md +++ b/docs/type_system/select.md @@ -5,23 +5,23 @@ A symbol associated with a type ```text -Select[[SINGLE | MULTIPLE] Type; Collection[VAR_TREE_LIST; .symbol : %const Value]] +Select[[ENUM | MASK] Type; Collection[VAR_TREE_LIST; .symbol : %const Value]] ``` ## Type Body Object Definitions ```c typedef struct { - kpl_type *var_tree, *var_list; + kpl_type *type, *var_tree, *var_list; } kpl_type_body_select; ``` # Alias ```text -Enum[Generic.T; Collection[.symbol : %const Value]] `alias Select[[SINGLE]; Generic.T; Collection[VAR_TREE_LIST; .symbol : %const Value]] +Enum `definition Select[[ENUM]; TYPE; Collection[VAR_TREE_LIST; .symbol : %const Value]] -Mask[Generic.T; Collection[.symbol]] `alias Select[[MULTIPLE]; Generic.T; Collection[VAR_TREE_LIST; .symbol]] +Mask `definition Select[[MASK]; Void; Collection[VAR_TREE_LIST; .symbol]] ``` ## Definition Example diff --git a/docs/type_system/union.md b/docs/type_system/union.md index 26429f1..bf9f857 100644 --- a/docs/type_system/union.md +++ b/docs/type_system/union.md @@ -17,9 +17,9 @@ typedef struct { # Alias ```text -Tag[Collection[VAR_TREE_LIST; TYPE.SYMBOL]] `alias Union[[TAG] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] +Tag `definition Union[[TAG] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] -Transient[Collection[VAR_TREE_LIST; TYPE.SYMBOL]] `alias Union[[TRANSIENT] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] +Transient `definition Union[[TRANSIENT] Collection[VAR_TREE_LIST; TYPE.SYMBOL]] ``` ## Tag Example diff --git a/docs/type_system/var.md b/docs/type_system/var.md index 8af2da5..6bf114d 100644 --- a/docs/type_system/var.md +++ b/docs/type_system/var.md @@ -14,3 +14,11 @@ typedef struct { 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 +``` |
