diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-06-26 15:56:39 -0400 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-06-26 15:56:39 -0400 |
| commit | ad516054002b4105197ef4fc37ac380cdf680750 (patch) | |
| tree | d0603a1dbc01ed777b304ac8567247491f8a5159 | |
| parent | 6f507405ac3b0a128c63134997849203e3493a91 (diff) | |
change how vars are identified
| -rw-r--r-- | docs/application/identifier.md | 17 | ||||
| -rw-r--r-- | docs/application/index.md | 18 | ||||
| -rw-r--r-- | docs/application/shared.md | 2 | ||||
| -rw-r--r-- | docs/application/type.md | 7 | ||||
| -rw-r--r-- | docs/lifecycle/scan.md | 5 | ||||
| -rw-r--r-- | docs/type_system/buffer.md | 4 | ||||
| -rw-r--r-- | docs/type_system/function.md | 4 | ||||
| -rw-r--r-- | docs/type_system/group.md | 9 | ||||
| -rw-r--r-- | docs/type_system/index.md | 10 | ||||
| -rw-r--r-- | docs/type_system/list.md | 2 | ||||
| -rw-r--r-- | docs/type_system/name.md | 2 | ||||
| -rw-r--r-- | docs/type_system/overload.md | 2 | ||||
| -rw-r--r-- | docs/type_system/select.md | 6 | ||||
| -rw-r--r-- | docs/type_system/symbol.md | 2 | ||||
| -rw-r--r-- | docs/type_system/union.md | 4 | ||||
| -rw-r--r-- | docs/type_system/var.md | 12 | ||||
| -rw-r--r-- | mkdocs.yml | 4 |
17 files changed, 71 insertions, 39 deletions
diff --git a/docs/application/identifier.md b/docs/application/identifier.md new file mode 100644 index 0000000..3195955 --- /dev/null +++ b/docs/application/identifier.md @@ -0,0 +1,17 @@ +# Identifier + +--- + +Store vars, types and symbols as compressed strings + +## Object Definitions + +```c +#define KPL_IDENTIFIER_PARTS 10 + +// TODO 100 charaters of [A-Za-z0-9_] in 80 bytes + +typedef struct { + uint64_t parts[KPL_IDENTIFIER_PARTS]; +} kpl_identifier; +``` diff --git a/docs/application/index.md b/docs/application/index.md index f8fe293..279ff6c 100644 --- a/docs/application/index.md +++ b/docs/application/index.md @@ -16,6 +16,7 @@ * ##### [Memory](./memory.md) * ##### [Io](./io.md) * ##### [Shared](./shared.md) +* ##### [Identifier](./identifier.md) * ##### [Type](./type.md) * ##### [Group](./group.md) * ##### [Buffer](./buffer.md) @@ -41,14 +42,13 @@ 1. ##### [Register](../lifecycle/register.md) 2. ##### [Parse](../lifecycle/parse.md) -3. ##### [Scan](../lifecycle/scan.md) -4. ##### Scope -5. ##### Import -6. ##### Check -7. ##### Eval -8. ##### Ir -9. ##### Jit -10. ##### Exec -11. ##### Notify +3. ##### Scan +4. ##### Import +5. ##### Check +6. ##### Eval +7. ##### Ir +8. ##### Jit +9. ##### Exec +10. ##### Notify ## Shutdown diff --git a/docs/application/shared.md b/docs/application/shared.md index e68b590..0990ae6 100644 --- a/docs/application/shared.md +++ b/docs/application/shared.md @@ -2,7 +2,7 @@ --- -## Object Definition +## Object Definitions ```c typedef struct _kpl_shared { diff --git a/docs/application/type.md b/docs/application/type.md index 5377cf6..e6adc81 100644 --- a/docs/application/type.md +++ b/docs/application/type.md @@ -17,17 +17,18 @@ typedef enum { } kpl_type_qualifiers; typedef union { - // ... + // 96 Bytes Max } kpl_type_body; typedef struct { kpl_type_template template; uint8_t qualifiers; uint16_t modifiers; + kpl_ptr self; + uint32_t token_position, token_length; + int32_t id; _Atomic int32_t ref_count; kpl_namespace_module *module; - uint32_t token_line, token_position, token_length; - kpl_ptr self; kpl_type_body body; } kpl_type; diff --git a/docs/lifecycle/scan.md b/docs/lifecycle/scan.md deleted file mode 100644 index 37a2718..0000000 --- a/docs/lifecycle/scan.md +++ /dev/null @@ -1,5 +0,0 @@ -# Scan - ---- - -Find and register modules diff --git a/docs/type_system/buffer.md b/docs/type_system/buffer.md index bb863a2..983fd4a 100644 --- a/docs/type_system/buffer.md +++ b/docs/type_system/buffer.md @@ -18,12 +18,14 @@ Array[Generic.T] `alias Buffer[[TYPE] Generic.T] # Operators -## ``length` +## Symbol Access ## ``get` ## ``set` +## ``length` + ## ``push` ## ``pop` diff --git a/docs/type_system/function.md b/docs/type_system/function.md index baf7337..f6a1f4f 100644 --- a/docs/type_system/function.md +++ b/docs/type_system/function.md @@ -11,13 +11,13 @@ STATEFUL : TASK | ITERATOR | CLOSURE | BOUND | REGEX FLAGS : INVOCATION | STATELESS | STATEFUL -Function[[FLAGS]; STATE; List; RETURN_TYPE; Collection[TYPE.SYMBOL]] +Function[[FLAGS]; STATE; List; RETURN_TYPE; Collection[VAR_TREE; TYPE.SYMBOL]] ``` # Alias ```text -Fn[Generic.T; Collection[TYPE.SYMBOL]] `alias Function[[FLAGS]; STATE; List; Generic.T; Collection[TYPE.SYMBOL]] +Fn[Generic.T; Collection[VAR_TREE; TYPE.SYMBOL]] `alias Function[[FLAGS]; STATE; List; Generic.T; Collection[VAR_TREE; TYPE.SYMBOL]] ``` # Inline Definition diff --git a/docs/type_system/group.md b/docs/type_system/group.md index 83fb4a5..d9c2d2d 100644 --- a/docs/type_system/group.md +++ b/docs/type_system/group.md @@ -5,19 +5,21 @@ A sequence of different types accessed by index or a symbol mapped to an index ```text -Group[[INDEX | SYMBOL] Collection[TYPE.SYMBOL]] +Group[[INDEX | SYMBOL] Collection[VAR_TREE; TYPE.SYMBOL]] ``` # Alias ```text -Tuple[Collection[TYPE.SYMBOL]] `alias Group[[INDEX] Collection[TYPE.SYMBOL]] +Tuple[Collection[TYPE.SYMBOL]] `alias Group[[INDEX] Collection[VAR_TREE; TYPE.SYMBOL]] -Table[Collection[TYPE.SYMBOL]] `alias Group[[SYMBOL] Collection[TYPE.SYMBOL]] +Table[Collection[TYPE.SYMBOL]] `alias Group[[SYMBOL] Collection[VAR_TREE; TYPE.SYMBOL]] ``` # Operators +## Symbol Access + ## ``get` ## ``set` @@ -27,6 +29,7 @@ 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) ``` diff --git a/docs/type_system/index.md b/docs/type_system/index.md index 07b9c69..4c2fe73 100644 --- a/docs/type_system/index.md +++ b/docs/type_system/index.md @@ -42,16 +42,22 @@ A template by name only expands to all inner fields as `Any` Generic for alias and unique types, type is replaced with type passed -## Collection[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 +## Identifier Templates + +* #### [Var](./var.md) + ## Value Templates * #### [Select](./select.md) @@ -102,8 +108,6 @@ Denotes that a field that does not resolve to anything * #### [Op](./op.md) -* #### [Var](./var.md) - * #### [List](./list.md) * #### [Lock](./lock.md) diff --git a/docs/type_system/list.md b/docs/type_system/list.md index be4a004..f14a06e 100644 --- a/docs/type_system/list.md +++ b/docs/type_system/list.md @@ -3,5 +3,5 @@ --- ```text -List[[STATEMENT | DEFINE | ACTION | LOOP | IF | MATCH | MUTATION] Parent; VAR_TREE; TARGET; STATEMENTS ...] +List[[ROOT | STATEMENT | DEFINE | ACTION | LOOP | IF | MATCH | MUTATION] Parent; VAR_TREE; TARGET; STATEMENTS ...] ``` diff --git a/docs/type_system/name.md b/docs/type_system/name.md index 1faeb3c..27bb784 100644 --- a/docs/type_system/name.md +++ b/docs/type_system/name.md @@ -3,5 +3,5 @@ --- ```text -Name[[UNKNOWN | IS_TYPE | ALIAS_TYPE | UNIQUE_TYPE] TYPE] +Name[[UNKNOWN | IS_TYPE | ALIAS_TYPE | UNIQUE_TYPE] TYPE; IDENTIFIER] ``` diff --git a/docs/type_system/overload.md b/docs/type_system/overload.md index 602871f..8e02054 100644 --- a/docs/type_system/overload.md +++ b/docs/type_system/overload.md @@ -5,7 +5,7 @@ List of complete functions, selected by signature ```text -Overload[[] Collection[Function[]]] +Overload[[] Collection[VAR_LIST; Function[]]] ``` ## Example diff --git a/docs/type_system/select.md b/docs/type_system/select.md index 73e7953..1b1d05a 100644 --- a/docs/type_system/select.md +++ b/docs/type_system/select.md @@ -5,15 +5,15 @@ A symbol associated with a type ```text -Select[[SINGLE | MULTIPLE] Type; Collection[.symbol : %const Value]] +Select[[SINGLE | MULTIPLE] Type; Collection[VAR_TREE; .symbol : %const Value]] ``` # Alias ```text -Enum[Generic.T; Collection[.symbol : %const Value]] `alias Select[[SINGLE]; Generic.T; Collection[.symbol : %const Value]] +Enum[Generic.T; Collection[.symbol : %const Value]] `alias Select[[SINGLE]; Generic.T; Collection[VAR_TREE; .symbol : %const Value]] -Mask[Generic.T; Collection[.symbol : %const Value]] `alias Select[[MULTIPLE]; Generic.T; Collection[.symbol : %const Value]] +Mask[Generic.T; Collection[.symbol : %const Value]] `alias Select[[MULTIPLE]; Generic.T; Collection[VAR_TREE; .symbol : %const Value]] ``` ## Definition Example diff --git a/docs/type_system/symbol.md b/docs/type_system/symbol.md index 5fb1c5e..3ce926e 100644 --- a/docs/type_system/symbol.md +++ b/docs/type_system/symbol.md @@ -3,5 +3,5 @@ --- ```text -Symbol[[] TARGET; TYPE] +Symbol[[] TARGET; TYPE; IDENTIFIER] ``` diff --git a/docs/type_system/union.md b/docs/type_system/union.md index 6682967..5a5b71f 100644 --- a/docs/type_system/union.md +++ b/docs/type_system/union.md @@ -3,13 +3,13 @@ --- ```text -Union[CONTAINER | TRANSIENT] Collection[TYPE.SYMBOL]] +Union[CONTAINER | TRANSIENT] Collection[VAR_TREE; TYPE.SYMBOL]] ``` # Alias ```text -Tag[Collection[TYPE.SYMBOL]] `alias Union[[CONTAINER] Collection[TYPE.SYMBOL]] +Tag[Collection[VAR_TREE; TYPE.SYMBOL]] `alias Union[[CONTAINER] Collection[VAR_TREE; TYPE.SYMBOL]] ``` ## Tag Example diff --git a/docs/type_system/var.md b/docs/type_system/var.md index 77e312c..86cbc8e 100644 --- a/docs/type_system/var.md +++ b/docs/type_system/var.md @@ -3,5 +3,15 @@ --- ```text -Var[[SCOPE | ARG | LOCAL | LOOP | IF | MATCH | MUTATE] TYPE; HASH; ID; LEFT_VAR; RIGHT_VAR] +Var[[SYMBOL | SCOPE | ARG | LOCAL | LOOP | IF | MATCH | MUTATE] TYPE; VALUE; LEFT_VAR; RIGHT_VAR; TREE_WEIGHT; IDENTIFIER] +``` + +## Type Body Object Definition + +```c +typedef struct { + kpl_ptr type, prev, next; + uint32_t tree_weight; + kpl_identifier identifier; +} type_var_body; ``` @@ -13,6 +13,7 @@ nav: - Types: 'type_system/index.md' - Alias: 'type_system/alias.md' - Unique: 'type_system/unique.md' + - Var: 'type_system/var.md' - Select: 'type_system/select.md' - Bit: 'type_system/bit.md' - Group: 'type_system/group.md' @@ -26,7 +27,6 @@ nav: - Empty: 'type_system/empty.md' - Ref: 'type_system/ref.md' - Shared: 'type_system/shared.md' - - Var: 'type_system/var.md' - Function: 'type_system/function.md' - Task: 'type_system/task.md' - Overload: 'type_system/overload.md' @@ -45,6 +45,7 @@ nav: - Memory: 'application/memory.md' - Io: 'application/io.md' - Shared: 'application/shared.md' + - Identifier: 'application/identifier.md' - Type: 'application/type.md' - Group: 'application/group.md' - Buffer: 'application/buffer.md' @@ -58,4 +59,3 @@ nav: - Life Cycle: - Register: 'lifecycle/register.md' - Parse: 'lifecycle/parse.md' - - Scan: 'lifecycle/scan.md' |
