summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornodist <kevin.comas.git@gmail.com>2026-06-10 13:34:38 -0400
committernodist <kevin.comas.git@gmail.com>2026-06-10 13:34:38 -0400
commit51d055dc7e1a6edbaedb7ea80b1e678eff924fe0 (patch)
tree03643ee752fb6df836d662df1ce099d547d708dd
parentaebce1e48e81559ffe5f496af855a1140d8e0107 (diff)
specify type representation
-rw-r--r--docs/application/type.md14
-rw-r--r--docs/type_system/bit.md46
-rw-r--r--docs/type_system/buffer.md8
-rw-r--r--docs/type_system/const.md2
-rw-r--r--docs/type_system/empty.md4
-rw-r--r--docs/type_system/enum.md16
-rw-r--r--docs/type_system/error.md6
-rw-r--r--docs/type_system/function.md13
-rw-r--r--docs/type_system/group.md7
-rw-r--r--docs/type_system/index.md22
-rw-r--r--docs/type_system/list.md4
-rw-r--r--docs/type_system/lock.md2
-rw-r--r--docs/type_system/map.md2
-rw-r--r--docs/type_system/name.md4
-rw-r--r--docs/type_system/namespace.md3
-rw-r--r--docs/type_system/native.md2
-rw-r--r--docs/type_system/op.md6
-rw-r--r--docs/type_system/overload.md2
-rw-r--r--docs/type_system/queue.md2
-rw-r--r--docs/type_system/ref.md2
-rw-r--r--docs/type_system/select.md24
-rw-r--r--docs/type_system/shared.md (renamed from docs/type_system/gc.md)14
-rw-r--r--docs/type_system/symbol.md2
-rw-r--r--docs/type_system/task.md2
-rw-r--r--docs/type_system/union.md16
-rw-r--r--docs/type_system/value.md2
-rw-r--r--docs/type_system/var.md4
-rw-r--r--mkdocs.yml6
28 files changed, 122 insertions, 115 deletions
diff --git a/docs/application/type.md b/docs/application/type.md
index 735d752..03cc055 100644
--- a/docs/application/type.md
+++ b/docs/application/type.md
@@ -15,16 +15,17 @@ typedef struct {
static const kpl_type_ptr kpl_type_ptr_null = { UINT16_MAX, UINT16_MAX };
-typedef enum : uint16_t {
+typedef enum : uint8_t {
// ...
} kpl_type_template;
-typedef enum : uint16_t {
- CONST = 1 << 0
+typedef enum : uint8_t {
+ CONST = 1 << 0,
EMPTY = 1 << 1,
REF = 1 << 2,
- GC = 1 << 3
-} kpl_type_flags;
+ SHARED = 1 << 3,
+ LOCK = 1 << 4
+} kpl_type_qualifiers;
typedef union {
// ...
@@ -32,7 +33,8 @@ typedef union {
typedef struct {
kpl_type_template template;
- kpl_type_flags flags;
+ kpl_type_qualifiers qualifiers;
+ uint16_t modifiers;
_Atomic int32_t ref_count;
kpl_type_ptr self, prev, next, parent;
kpl_type_body body;
diff --git a/docs/type_system/bit.md b/docs/type_system/bit.md
index 18ac6a8..11cecef 100644
--- a/docs/type_system/bit.md
+++ b/docs/type_system/bit.md
@@ -5,15 +5,13 @@
A sequence of bits that can fit into a general register
```text
-Bit_size `alias Enum[Void; .bit_any; .bit8; .bit16; .bit32; .bit64]
+SIZE_FLAGS : BIT_ANY | BIT8 | BIT16 | BIT32 | BIT64
-Bit_representation `alias Enum[Void
- .numeric; .int; .int_unsiged; .int_signed; .float
- .utf8; .utf16; .utf32
- .bool
-]
+REPRESENTATION_FLAGS : NUMERIC | INT | INT_UNSIGNED | INT_SIGNED | FLOAT |
+ UTF8 | UTF16 | UTF32 |
+ BOOL
-Bit[Bit_size; Bit_representation]
+Bit[[SIZE_FLAGS | REPRESENTATION_FLAGS]]
```
# Casting
@@ -21,32 +19,32 @@ Bit[Bit_size; Bit_representation]
# Alias
```text
-Number `alias Bit[.bit_any; .numeric]
+Number `alias Bit[[BIT_ANT | NUMERIC]]
-Int `alias Bit[.bit_any; .int]
+Int `alias Bit[[BIT_ANY | INT]]
-Int_unsiged `alias Bit[.bit_any; .int_unsiged]
+Int_unsiged `alias Bit[[BIT_ANY | INT_UNSIGNED]]
-U8 `alias Bit[.bit8; .int_unsiged]
-U16 `alias Bit[.bit16; .int_unsiged]
-U32 `alias Bit[.bit32; .int_unsiged]
-U64 `alias Bit[.bit64; .int_unsiged]
+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]
+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]
+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]
+Float `alias Bit[[BIT_ANY | FLOAT]]
-F32 `alias Bit[.bit32; .float]
-F64 `alias Bit[.bit64; .float]
+F32 `alias Bit[[BIT32 | FLOAT]]
+F64 `alias Bit[[BIT64 | FLOAT]]
-Char `alias Bit[.bit32; .utf8]
+Char `alias Bit[[BIT32 | UTF8]]
-Bool `alias Bit[.bit8; .bool]
+Bool `alias Bit[[BIT8 | BOOL]]
```
# Operators
diff --git a/docs/type_system/buffer.md b/docs/type_system/buffer.md
index 7e21a21..0933c8a 100644
--- a/docs/type_system/buffer.md
+++ b/docs/type_system/buffer.md
@@ -5,17 +5,15 @@
An sequence of bytes with unknown size and a byte representation
```text
-Buffer_repesentation: Enum[Void; .type; .utf8; .utf16; .utf32]
-
-Buffer[Buffer_repesentation; TYPE]
+Buffer[[TYPE | UTF8 | UTF16 | UTF32] TYPE]
```
# Alias
```text
-String `alias Buffer[.utf8; Void]
+String `alias Buffer[[UTF8] Void]
-Array[Generic.T] `alias Buffer[.type; Generic.T]
+Array[Generic.T] `alias Buffer[[TYPE] Generic.T]
```
# Operators
diff --git a/docs/type_system/const.md b/docs/type_system/const.md
index db1f683..cb9cd74 100644
--- a/docs/type_system/const.md
+++ b/docs/type_system/const.md
@@ -5,5 +5,5 @@
Cannot be changed or mutated
```text
-Const[TYPE]
+Const[[] TYPE]
```
diff --git a/docs/type_system/empty.md b/docs/type_system/empty.md
index 6097711..09869d6 100644
--- a/docs/type_system/empty.md
+++ b/docs/type_system/empty.md
@@ -4,6 +4,10 @@
Container type can be null
+```text
+Empty[[] TYPE]
+```
+
## Use with `Option` Union
```text
diff --git a/docs/type_system/enum.md b/docs/type_system/enum.md
deleted file mode 100644
index ebcaea6..0000000
--- a/docs/type_system/enum.md
+++ /dev/null
@@ -1,16 +0,0 @@
-# Enum
-
----
-
-A symbol associated with a type
-
-```text
-Enum[TYPE; Collection[.symbol : Const[Value]]]
-```
-
-## Definition Example
-
-```text
-E : Enum[I64; .a; .b; .c]
-`log E // Enum[I64; .a : 0; .b : 1; .c : 2]
-```
diff --git a/docs/type_system/error.md b/docs/type_system/error.md
index cdcf7d6..bbf58c7 100644
--- a/docs/type_system/error.md
+++ b/docs/type_system/error.md
@@ -5,7 +5,11 @@
An error for reporting, the data used to create it cannot be accessed
```text
-Error
+Error[[]]
+```
+
+## Example
+```text
e : Error $ "This is an error"
```
diff --git a/docs/type_system/function.md b/docs/type_system/function.md
index cd25254..d0fabc5 100644
--- a/docs/type_system/function.md
+++ b/docs/type_system/function.md
@@ -3,20 +3,15 @@
---
```text
-Function_class `alias Enum[Void
- .unknown; .incomplete; .native
- .task; process; .generator; .iterator; .closure;
- .bound;
- .regex
-]
-
-Function[Function_class; STATE; List; RETURN_TYPE; Collection[TYPE.SYMBOL]]
+KIND : UNKNOWN | INCOMPLETE | NATIVE | TASK | PROCESS | GENERATOR | ITERATOR | CLOSURE | BOUND | REGEX
+
+Function[[KIND] STATE; List; RETURN_TYPE; Collection[TYPE.SYMBOL]]
```
# Alias
```text
-Fn[Generic.T; Collection[TYPE.SYMBOL]] `alias Function[Any; STATE; List; Generic.T; Collection[TYPE.SYMBOL]]
+Fn[Generic.T; Collection[TYPE.SYMBOL]] `alias Function[[KIND]; STATE; List; Generic.T; Collection[TYPE.SYMBOL]]
```
# Inline Definition
diff --git a/docs/type_system/group.md b/docs/type_system/group.md
index f54de6d..83fb4a5 100644
--- a/docs/type_system/group.md
+++ b/docs/type_system/group.md
@@ -5,16 +5,15 @@
A sequence of different types accessed by index or a symbol mapped to an index
```text
-Group_access `alias Enum[Void; .index; .symbol]
-Group[Tuple_access; Collection[TYPE.SYMBOL]]
+Group[[INDEX | SYMBOL] Collection[TYPE.SYMBOL]]
```
# Alias
```text
-Tuple[Collection[TYPE.SYMBOL]] `alias Group[.index; Collection[TYPE.SYMBOL]]
+Tuple[Collection[TYPE.SYMBOL]] `alias Group[[INDEX] Collection[TYPE.SYMBOL]]
-Table[Collection[TYPE.SYMBOL]] `alias Group[.symbol; Collection[TYPE.SYMBOL]]
+Table[Collection[TYPE.SYMBOL]] `alias Group[[SYMBOL] Collection[TYPE.SYMBOL]]
```
# Operators
diff --git a/docs/type_system/index.md b/docs/type_system/index.md
index 3601459..ae574d9 100644
--- a/docs/type_system/index.md
+++ b/docs/type_system/index.md
@@ -6,12 +6,28 @@
---
+# 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; ...]
+Template[[] Field; ...]
```
If a field in a template is not filed, one of these are required:
@@ -38,7 +54,7 @@ Denotes that a field that does not resolve to anything
## Value Templates
-* #### [Enum](./enum.md)
+* #### [Select](./select.md)
* #### [Bit](./bit.md)
@@ -66,7 +82,7 @@ Denotes that a field that does not resolve to anything
* #### [Ref](./ref.md)
-* #### [Gc](./gc.md)
+* #### [Shared](./shared.md)
## Function Templates
diff --git a/docs/type_system/list.md b/docs/type_system/list.md
index 618c531..27f3a6e 100644
--- a/docs/type_system/list.md
+++ b/docs/type_system/list.md
@@ -3,7 +3,5 @@
---
```text
-List_class `alias Enum[Void; .statement; .define; .action; .loop; .if; .match; .mutation]
-
-List[List_class; Parent; SCOPE; TARGET; STATEMENTS ...]
+List[[STATEMENT | DEFINE | ACTION | LOOP | IF | MATCH | MUTATION] Parent; VARS; TARGET; STATEMENTS ...]
```
diff --git a/docs/type_system/lock.md b/docs/type_system/lock.md
index b3227ca..913a532 100644
--- a/docs/type_system/lock.md
+++ b/docs/type_system/lock.md
@@ -5,5 +5,5 @@
Prevent access to a parent while children are modifiable
```text
-Lock[Name[...]; TYPE]
+Lock[[] Name[...]; TYPE]
```
diff --git a/docs/type_system/map.md b/docs/type_system/map.md
index 4947842..43e1291 100644
--- a/docs/type_system/map.md
+++ b/docs/type_system/map.md
@@ -3,7 +3,7 @@
---
```text
-Map[KEY_TYPE; VALUE_TYPE]
+Map[[] KEY_TYPE; VALUE_TYPE]
```
# Alias
diff --git a/docs/type_system/name.md b/docs/type_system/name.md
index 1b7c82c..10a6ac3 100644
--- a/docs/type_system/name.md
+++ b/docs/type_system/name.md
@@ -3,7 +3,5 @@
---
```text
-Name_class `alias Enum[Void; .unknown; .is_type; .alias_type; .unique_type]
-
-Name[Name_class; TYPE; NAME_IDENTIFIER]
+Name[[UNKNOWN | IS_TYPE | ALIAS_TYPE | UNIQUE_TYPE] TYPE; NAME_IDENTIFIER]
```
diff --git a/docs/type_system/namespace.md b/docs/type_system/namespace.md
index 8879db4..9243280 100644
--- a/docs/type_system/namespace.md
+++ b/docs/type_system/namespace.md
@@ -3,8 +3,7 @@
---
```text
-Namespace_class `alias Enum[Void; .native; .file]
-Namespace[Namespace_class; NAMESPACE_IDENTIFIER]
+Namespace[[NATIVE | FILE] NAMESPACE_IDENTIFIER]
```
A file with code
diff --git a/docs/type_system/native.md b/docs/type_system/native.md
index 64f0cc9..875314f 100644
--- a/docs/type_system/native.md
+++ b/docs/type_system/native.md
@@ -5,7 +5,7 @@
A representation of a native object
```text
-Native[INTERFACE_TABLE_POINTER]
+Native[[] INTERFACE_TABLE_POINTER]
```
## Alias
diff --git a/docs/type_system/op.md b/docs/type_system/op.md
index 6280cc9..198d73f 100644
--- a/docs/type_system/op.md
+++ b/docs/type_system/op.md
@@ -3,7 +3,7 @@
---
```text
-Op_class `alias Enum[Void; .loop; .if; .match; .mutation; .selection; ...]
-
-Op[Op_class; RETURN_TYPE; LEFT_TYPE; RIGHT_TYPE]
+Op[[OP_NAME] RETURN_TYPE; LEFT_TYPE; RIGHT_TYPE]
```
+
+The `OP_NAME` a single value
diff --git a/docs/type_system/overload.md b/docs/type_system/overload.md
index 341a533..602871f 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[Function[]]]
```
## Example
diff --git a/docs/type_system/queue.md b/docs/type_system/queue.md
index bd7a0c4..0a15d36 100644
--- a/docs/type_system/queue.md
+++ b/docs/type_system/queue.md
@@ -3,7 +3,7 @@
---
```text
-Queue[TYPE]
+Queue[[] TYPE]
```
# Operators
diff --git a/docs/type_system/ref.md b/docs/type_system/ref.md
index a5541c3..a856e72 100644
--- a/docs/type_system/ref.md
+++ b/docs/type_system/ref.md
@@ -3,7 +3,7 @@
---
```text
-Ref[TYPE]
+Ref[[] TYPE]
```
A reference, cannot be assigned
diff --git a/docs/type_system/select.md b/docs/type_system/select.md
new file mode 100644
index 0000000..b2f8f61
--- /dev/null
+++ b/docs/type_system/select.md
@@ -0,0 +1,24 @@
+# Select
+
+---
+
+A symbol associated with a type
+
+```text
+Select[[SINGLE | MULTIPLE] Type; Collection[.symbol : Const[Value]]]
+```
+
+# Alias
+
+```text
+Enum[Generic.T; Collection[.symbol : Const[Value]]] `alias Select[[SINGLE]; Generic.T; Collection[.symbol : Const[Value]]]
+
+Mask[Generic.T; Collection[.symbol : Const[Value]]] `alias Select[[MULTIPLE]; Generic.T; Collection[.symbol : Const[Value]]]
+```
+
+## Definition Example
+
+```text
+E : Enum[I64; .a; .b; .c]
+`log E // Enum[I64; .a : 0; .b : 1; .c : 2]
+```
diff --git a/docs/type_system/gc.md b/docs/type_system/shared.md
index 3fcf88e..db8e6dc 100644
--- a/docs/type_system/gc.md
+++ b/docs/type_system/shared.md
@@ -1,22 +1,14 @@
-# Gc
+# Shared
---
Hold multiple references to the same object
```text
-Gc[Type; GC_FLAGS]
+Shared[[LOCK] Type]
```
-# Alias
-
-```text
-Shared[Generic.T] `alias Gc[Generic.T; GC_FLAGS]
-```
-
-## `GC_FLAGS`
-
-### Lock Mutex
+### `LOCK`
The shared type has been detected across asynchronous tasks and needs to lock the mutex on mutation
diff --git a/docs/type_system/symbol.md b/docs/type_system/symbol.md
index cb0fc11..7906852 100644
--- a/docs/type_system/symbol.md
+++ b/docs/type_system/symbol.md
@@ -3,5 +3,5 @@
---
```text
-Symbol[TARGET; TYPE; NAME_IDENTIFIER]
+Symbol[[] TARGET; TYPE; NAME_IDENTIFIER]
```
diff --git a/docs/type_system/task.md b/docs/type_system/task.md
index e0d9db3..2cb0a4d 100644
--- a/docs/type_system/task.md
+++ b/docs/type_system/task.md
@@ -5,7 +5,7 @@
A segment of code assigned to a process, task code can be recursive
```text
-Task[TYPE]
+Task[[] TYPE]
```
## \`await
diff --git a/docs/type_system/union.md b/docs/type_system/union.md
index 2c985e0..6682967 100644
--- a/docs/type_system/union.md
+++ b/docs/type_system/union.md
@@ -3,15 +3,13 @@
---
```text
-Union_class `alias Enum[Void; .container; .transient]
-
-Union[Union_class; Collection[TYPE.SYMBOL]]
+Union[CONTAINER | TRANSIENT] Collection[TYPE.SYMBOL]]
```
# Alias
```text
-Tag[Collection[TYPE.SYMBOL]] `alias Union[.container; Collection[TYPE.SYMBOL]]
+Tag[Collection[TYPE.SYMBOL]] `alias Union[[CONTAINER] Collection[TYPE.SYMBOL]]
```
## Tag Example
@@ -36,15 +34,15 @@ Can only be retuned from functions and operations. The inner value must be moved
## Alias
```text
-Result[Generic.T] `alias Union[.transient; Generic.T.value; Error.error]
+Result[Generic.T] `alias Union[[TRANSIENT] Generic.T.value; Error.error]
-Option[Generic.T] `alias Union[.transient; Generic.T.some; Void.none]
+Option[Generic.T] `alias Union[[TRANSIENT] Generic.T.some; Void.none]
-Next[Generic.T] `alias Union[.transient; Generic.T.iter; Void.done]
+Next[Generic.T] `alias Union[[TRANSIENT] Generic.T.iter; Void.done]
-Next_result[Generic.T] `alias Union[.transient; Generic.T.value; Error.error; Void.done]
+Next_result[Generic.T] `alias Union[[TRANSIENT] Generic.T.value; Error.error; Void.done]
-Next_option[Generic.T] `alias Union[.transient; Generic.T.some; Void.none; Void.done]
+Next_option[Generic.T] `alias Union[[TRANSIENT] Generic.T.some; Void.none; Void.done]
```
## Default Operation
diff --git a/docs/type_system/value.md b/docs/type_system/value.md
index 53807ba..683b1f2 100644
--- a/docs/type_system/value.md
+++ b/docs/type_system/value.md
@@ -3,5 +3,5 @@
---
```text
-Value[TYPE; DATA]
+Value[[] TYPE; DATA]
```
diff --git a/docs/type_system/var.md b/docs/type_system/var.md
index 737263e..206b890 100644
--- a/docs/type_system/var.md
+++ b/docs/type_system/var.md
@@ -3,7 +3,5 @@
---
```text
-Var_class `alias Enum[Void; .arg; .local; .loop; .if; .match; .mutate]
-
-Var[Var_class; TYPE; Parent; VAR_IDENTIFIER]
+Var[[ARG | LOCAL | LOOP | IF | MATCH | MUTATE] TYPE; Parent; VAR_IDENTIFIER]
```
diff --git a/mkdocs.yml b/mkdocs.yml
index 370bce9..f220a9a 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -10,10 +10,10 @@ nav:
- Operators: 'language/operators.md'
- Ownership: 'language/ownership.md'
- Type System:
- - Templates: 'type_system/index.md'
+ - Types: 'type_system/index.md'
- Alias: 'type_system/alias.md'
- Unique: 'type_system/unique.md'
- - Enum: 'type_system/enum.md'
+ - Select: 'type_system/select.md'
- Bit: 'type_system/bit.md'
- Group: 'type_system/group.md'
- Buffer: 'type_system/buffer.md'
@@ -25,7 +25,7 @@ nav:
- Const: 'type_system/const.md'
- Empty: 'type_system/empty.md'
- Ref: 'type_system/ref.md'
- - Gc: 'type_system/gc.md'
+ - Shared: 'type_system/shared.md'
- Var: 'type_system/var.md'
- Function: 'type_system/function.md'
- Task: 'type_system/task.md'