summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/application/buffer.md7
-rw-r--r--docs/application/index.md20
-rw-r--r--docs/application/interface.md11
-rw-r--r--docs/application/memory.md6
-rw-r--r--docs/application/namespace.md3
-rw-r--r--docs/application/shared.md3
-rw-r--r--docs/application/testing.md8
-rw-r--r--docs/application/thread.md7
-rw-r--r--docs/lifecycle/check.md3
-rw-r--r--docs/lifecycle/eval.md3
-rw-r--r--docs/lifecycle/import.md3
-rw-r--r--docs/lifecycle/parse.md32
-rw-r--r--docs/lifecycle/register.md6
-rw-r--r--docs/lifecycle/scope.md15
-rw-r--r--docs/type_system/bit.md4
-rw-r--r--docs/type_system/buffer.md2
-rw-r--r--docs/type_system/empty.md2
-rw-r--r--docs/type_system/function.md23
-rw-r--r--docs/type_system/list.md4
-rw-r--r--docs/type_system/union.md20
-rw-r--r--mkdocs.yml4
21 files changed, 126 insertions, 60 deletions
diff --git a/docs/application/buffer.md b/docs/application/buffer.md
index ea30458..92de6ae 100644
--- a/docs/application/buffer.md
+++ b/docs/application/buffer.md
@@ -7,10 +7,15 @@
```c
typedef struct _kpl_buffer {
KPL_ALLOC_HEADER(struct _kpl_buffer);
- size_t byte_length;
+ size_t byte_length : KPL_ALLOC_POOL_SIZE;
+ int32_t io_register_index : KPL_ALLOC_WEIGHT;
kpl_interface *interface;
uint8_t bytes[];
} kpl_buffer;
```
+## Io uring buffer register
+
+### Set `io_register_index` to -1 of not used
+
## Unicode Methods
diff --git a/docs/application/index.md b/docs/application/index.md
index d99b941..40a03b8 100644
--- a/docs/application/index.md
+++ b/docs/application/index.md
@@ -2,13 +2,13 @@
---
-# Requirements
+## Requirements
* Linux X64 with io_uring (6+)
* GNU Make
* GCC with -std=gnu99 -fhardened (14+)
-# Sections
+## Sections
* ##### [Interface](./interface.md)
* ##### [Thread](./thread.md)
@@ -34,8 +34,8 @@
1. Configuration
2. Initialize tasks
-3. Initialize types
-4. Initialize allocators
+2. Initialize allocators
+4. Initialize types
5. Initialize IO
## Main
@@ -48,10 +48,10 @@
1. ##### [Register](../lifecycle/register.md)
2. ##### [Parse](../lifecycle/parse.md)
-3. ##### Scope
-4. ##### Import
-5. ##### Check
-6. ##### Eval
+3. ##### [Scope](../lifecycle/scope.md)
+4. ##### [Import](../lifecycle/import.md)
+5. ##### [Check](../lifecycle/check.md)
+6. ##### [Eval](../lifecycle/eval.md)
7. ##### Ir
8. ##### Jit
9. ##### Exec
@@ -60,6 +60,6 @@
## Shutdown
1. Clean up IO
-2. Clean up allocators
-3. Clean up types
+2. Clean up types
+3. Clean up allocators
4. Clean up tasks
diff --git a/docs/application/interface.md b/docs/application/interface.md
index e1c947a..790c155 100644
--- a/docs/application/interface.md
+++ b/docs/application/interface.md
@@ -43,23 +43,20 @@ typedef struct {
typedef enum : uint8_t {
KPL_STATUS_ERROR,
- KPL_STATUS_VALUE,
KPL_STATUS_NULL,
- KPL_STATUS_DONE
-} kpl_status;
+ KPL_STATUS_VALUE
+} kpl_result_status;
typedef struct {
any value;
- kpl_status status;
+ kpl_result_status status;
} kpl_result;
kpl_result kpl_result_error(error *er);
-kpl_result kpl_result_value(any value);
-
kpl_result kpl_result_null(void);
-kpl_result kpl_result_done(void);
+kpl_result kpl_result_value(any value);
typdef struct {
uint16_t slab_index, array_index;
diff --git a/docs/application/memory.md b/docs/application/memory.md
index a8e75b8..e7f05ba 100644
--- a/docs/application/memory.md
+++ b/docs/application/memory.md
@@ -7,9 +7,9 @@
```c
#define KPL_ALLOC_POOL_SIZE 40
-#define KPL_TREE_WEIGHT 24
+#define KPL_ALLOC_WEIGHT 24
-#define KPL_ALLOC_HEADER(STRCUT) size_t obj_size : KPL_ALLOC_POOL_SIZE; uint32_t tree_weight : KPL_TREE_WEIGHT; STRCUT *prev
+#define KPL_ALLOC_HEADER(STRCUT) size_t obj_size : KPL_ALLOC_POOL_SIZE; uint32_t tree_weight : KPL_ALLOC_WEIGHT; STRCUT *prev
typedef struct _kpl_alloc_obj {
KPL_ALLOC_HEADER(_kpl_alloc_obj);
@@ -39,7 +39,7 @@ typdef strcut _kpl_slab_list_obj {
KPL_SLAB_LIST_HEADER(strcut _kpl_slab_list_obj);
} kpl_slab_list_obj;
-#define KPL_SLAB_TREE_HEADER(STRUCT) STRUCT *prev, *next; uin32_t tree_weight : KPL_TREE_WEIGHT
+#define KPL_SLAB_TREE_HEADER(STRUCT) STRUCT *prev, *next; uint32_t tree_weight : KPL_ALLOC_WEIGHT
typdef strcut _kpl_slab_tree_obj {
KPL_SLAB_TREE_HEADER(struct _kpl_slab_tree_obj);
diff --git a/docs/application/namespace.md b/docs/application/namespace.md
index 38752ce..c6b8cea 100644
--- a/docs/application/namespace.md
+++ b/docs/application/namespace.md
@@ -26,7 +26,6 @@ typedef struct _kpl_namespace_module {
KPL_SLAB_TREE_HEADER(struct _kpl_namespace_module);
kpl_type_ptr ast;
kpl_buffer *module_string, *module_name;
- kpl_task *_Atomic task;
kpl_export *export_tree;
kpl_mutex export_mutex;
} kpl_namespace_module;
@@ -92,5 +91,5 @@ Since the native modules are loaded statically the `native_module_tree` becomes
1. Add find namespace task to the `namespace_module_mutex`, the namespace not existing is an error
2. Add a get export task to the namespaces `export_mutex`
-3. The `export_mutex` will not start processing it's queue until the `task` field is `NULL`
+3. The `export_mutex` will not start processing it's queue until the namespace notifies that it's and unlocks its `export_mutex`
4. The importer will get a copy of the read only `export_tree`
diff --git a/docs/application/shared.md b/docs/application/shared.md
index 3a3f4f7..89ba292 100644
--- a/docs/application/shared.md
+++ b/docs/application/shared.md
@@ -24,7 +24,8 @@ static kpl_mutex shared_head_mutex;
## Initiation Task
1. Move `shared_head` to `shared_mark_head`
-2. Add a mark task to each of the threads
+2. Set `shared_threads_makred` to 0
+3. Add a mark task to each of the threads
## Mark Task(s)
diff --git a/docs/application/testing.md b/docs/application/testing.md
index 2964fae..710915c 100644
--- a/docs/application/testing.md
+++ b/docs/application/testing.md
@@ -42,3 +42,11 @@ typedef struct {
// TODO FAIL
```
+
+## `make test`
+
+Bundle all tests into a single executable
+
+## `TEST_FILES="$NAMES..." make test`
+
+Only build specified file(s)
diff --git a/docs/application/thread.md b/docs/application/thread.md
index 7ed5cae..770358f 100644
--- a/docs/application/thread.md
+++ b/docs/application/thread.md
@@ -9,10 +9,10 @@ typedef struct _kpl_task kpl_task;
typedef void kpl_task_fn(kpl_task *t);
-#define KPL_TASK_STATE_SIZE 32
+#define KPL_TASK_STATE_SIZE 24
typedef struct _task {
- task *_Atomic next, *join;
+ task *_Atomic next, *join, *parent;
kpl_class state[KPL_TASK_STATE_SIZE];
kpl_result result;
task_fn *fn;
@@ -43,7 +43,8 @@ typedef struct {
typedef struct {
kpl_task_queue queue;
_Atomic ssize_t priority;
- size_t slab_array_index;
+ uint32_t slab_array_index;
+ _Atomic uint32_t pool_size;
kpl_task_slab *slab;
kpl_task *pool;
sem_t counter;
diff --git a/docs/lifecycle/check.md b/docs/lifecycle/check.md
new file mode 100644
index 0000000..3e8177e
--- /dev/null
+++ b/docs/lifecycle/check.md
@@ -0,0 +1,3 @@
+# Check
+
+---
diff --git a/docs/lifecycle/eval.md b/docs/lifecycle/eval.md
new file mode 100644
index 0000000..8572f21
--- /dev/null
+++ b/docs/lifecycle/eval.md
@@ -0,0 +1,3 @@
+# Eval
+
+---
diff --git a/docs/lifecycle/import.md b/docs/lifecycle/import.md
new file mode 100644
index 0000000..bf7635d
--- /dev/null
+++ b/docs/lifecycle/import.md
@@ -0,0 +1,3 @@
+# Import
+
+---
diff --git a/docs/lifecycle/parse.md b/docs/lifecycle/parse.md
index 4c5851d..c9da979 100644
--- a/docs/lifecycle/parse.md
+++ b/docs/lifecycle/parse.md
@@ -4,4 +4,34 @@
Build initial AST
-## Initialize
+# Value
+
+## Integer `\d+`
+
+## Float `\d+\.\d+`
+
+## String `".*?"`
+
+## Char `'\\?.'
+
+# Name `[_a-z][a-zA-z0-9_]{0,59}`
+
+# Type `[A-Z][a-zA-z0-9_]{0,59}`
+
+On type completion look up if type is a builtin
+
+# Symbol `\.[a-zA-z0-9_]{0,60}`
+
+# Op
+
+## Op ``[a-z_]+|OPERATORS`
+
+## Action `[?@#^]`
+
+# List
+
+## List `()`
+
+## Define `[]`
+
+## Action `{}`
diff --git a/docs/lifecycle/register.md b/docs/lifecycle/register.md
index 5db7759..bffb3a8 100644
--- a/docs/lifecycle/register.md
+++ b/docs/lifecycle/register.md
@@ -6,11 +6,11 @@
1. Add findsert task to `namespace_module_mutex`
* If found, stop
-2. Create the namespace and add to namespace tree
+2. Create the namespace, lock its `export_mutex` and add to namespace tree
3. Create task on the new namespaces to read the file into a string
-4. On completion of the read task add a parse task into the namespace mutex
+4. On completion of the read task start a parse task
## String
1. Add task to set new `kpl_buffer` to `namespace_string` `module_string`
-2. The set task will add a parse task to `namespace_string`
+2. The set task will start a parse task
diff --git a/docs/lifecycle/scope.md b/docs/lifecycle/scope.md
new file mode 100644
index 0000000..849c52d
--- /dev/null
+++ b/docs/lifecycle/scope.md
@@ -0,0 +1,15 @@
+# Scope
+
+---
+
+Traverse AST and:
+
+## Link Parent Lists
+
+## Create Vars
+
+## Initialize Functions
+
+## Register Imports
+
+On finding an import node add a register task for the imported string
diff --git a/docs/type_system/bit.md b/docs/type_system/bit.md
index ba11f30..e30a536 100644
--- a/docs/type_system/bit.md
+++ b/docs/type_system/bit.md
@@ -7,7 +7,7 @@ A sequence of bits that can fit into a general register
```text
SIZE_FLAGS : BIT_ANY | BIT8 | BIT16 | BIT32 | BIT64
-REPRESENTATION_FLAGS : NUMERIC | INT | INT_UNSIGNED | INT_SIGNED | FLOAT |
+REPRESENTATION_FLAGS : INT | INT_UNSIGNED | INT_SIGNED | FLOAT |
UTF8 | UTF16 | UTF32 |
BOOL
@@ -27,8 +27,6 @@ typedef struct {
# Alias
```text
-Number `alias Bit[[BIT_ANT | NUMERIC]]
-
Int `alias Bit[[BIT_ANY | INT]]
Int_unsiged `alias Bit[[BIT_ANY | INT_UNSIGNED]]
diff --git a/docs/type_system/buffer.md b/docs/type_system/buffer.md
index dca8ab9..f351b4f 100644
--- a/docs/type_system/buffer.md
+++ b/docs/type_system/buffer.md
@@ -38,6 +38,8 @@ Array[Generic.T] `alias Buffer[[TYPE] Generic.T]
## ``pop`
+## ``reverse`
+
## ``join`
## ``split`
diff --git a/docs/type_system/empty.md b/docs/type_system/empty.md
index 2fae1e7..5903c19 100644
--- a/docs/type_system/empty.md
+++ b/docs/type_system/empty.md
@@ -8,7 +8,7 @@ Container type can be null
%empty
```
-## Use with `Option` Union
+## Use with `Result` Union
```text
make_array : ([yes]
diff --git a/docs/type_system/function.md b/docs/type_system/function.md
index af17b74..ed1cf9d 100644
--- a/docs/type_system/function.md
+++ b/docs/type_system/function.md
@@ -3,15 +3,16 @@
---
```text
-INVOCATION : UNKNOWN | SYNC | ASYNC
-STATELESS : INCOMPLETE | NATIVE | NATIVE_INLINE | PROCESS | GENERATOR | REGEX_GENERATOR
+MODE: INCOMPLETE | COMPLETE
-STATEFUL : TASK | ITERATOR | CLOSURE | BOUND | REGEX
+INVOCATION : SYNC | ASYNC
+
+STATELESS : NATIVE | NATIVE_INLINE | PROCESS | GENERATOR | REGEX_GENERATOR
-FLAGS : INVOCATION | STATELESS | STATEFUL
+STATEFUL : TASK | ITERATOR | CLOSURE | BOUND | REGEX
-Function[[FLAGS]; Body; RETURN_TYPE; Collection[VAR_LIST; TYPE.SYMBOL]]
+Function[[MODE | INVOCATION | STATELESS | STATEFUL]; INVOCATION_LIST; Body; RETURN_TYPE; Collection[VAR_LIST; TYPE.SYMBOL]]
```
## Type Body Object Definitions
@@ -25,7 +26,7 @@ typedef struct {
# Alias
```text
-Fn[Generic.T; Collection[VAR_TREE_LIST; TYPE.SYMBOL]] `alias Function[[FLAGS]; STATE; List; Generic.T; Collection[VAR_TREE_LIST; TYPE.SYMBOL]]
+Fn[Generic.T; Collection[VAR_TREE_LIST; TYPE.SYMBOL]] `alias Function[...]
```
# Inline Definition
@@ -37,13 +38,13 @@ Fn[Generic.T; Collection[VAR_TREE_LIST; TYPE.SYMBOL]] `alias Function[[FLAGS]; S
# Function Classes
-## Unknown
+## Incomplete
-Placeholder before evaluation
+A function with an incomplete type, type checking occurs at invocation its complete types are stored in its `INVOCATION_LIST`
-## Incomplete
+## Complete
-A function with an incomplete type, type checking occurs at invocation
+A function with a complete type, its sync/async invocations are stored in the `INVOCATION_LIST`
## Native
@@ -95,7 +96,7 @@ Invoked regular expression matcher
## \`yield
-Yielding wraps the value in the transient union `Next`
+Yielding wraps the value in the transient union `Iteration`
Return `Void` to stop iteration
diff --git a/docs/type_system/list.md b/docs/type_system/list.md
index cbd7f84..b3c6dd7 100644
--- a/docs/type_system/list.md
+++ b/docs/type_system/list.md
@@ -3,13 +3,13 @@
---
```text
-List[[ROOT | STATEMENT | DEFINE | ACTION | LOOP | IF | MATCH | MUTATION] PARENT; TARGET; VAR_TREE; Collection[LIST; TYPE]]
+List[[ROOT | STATEMENT | DEFINE | ACTION | LOOP | IF | MATCH | MUTATION] PARENT; TARGET; ARG; LOOP; VAR_TREE; Collection[LIST; TYPE]]
```
## Type Body Object Definitions
```c
typedef struct {
- kpl_ptr parent, target, var_tree, statement_list;
+ kpl_ptr parent, target, defined, named, var_tree, statement_list;
} kpl_type_body_list;
```
diff --git a/docs/type_system/union.md b/docs/type_system/union.md
index 2572591..f4b0b04 100644
--- a/docs/type_system/union.md
+++ b/docs/type_system/union.md
@@ -3,7 +3,7 @@
---
```text
-Union[CONTAINER | TRANSIENT | TRANSIENT_GENERIC] Collection[VAR_TREE_LIST; TYPE.SYMBOL]]
+Union[TAG | TRANSIENT] Collection[VAR_TREE_LIST; TYPE.SYMBOL]]
```
## Type Body Object Definitions
@@ -17,7 +17,9 @@ typedef struct {
# Alias
```text
-Tag[Collection[VAR_TREE_LIST; TYPE.SYMBOL]] `alias Union[[CONTAINER] Collection[VAR_TREE_LIST; TYPE.SYMBOL]]
+Tag[Collection[VAR_TREE_LIST; TYPE.SYMBOL]] `alias Union[[TAG] Collection[VAR_TREE_LIST; TYPE.SYMBOL]]
+
+Transient[Collection[VAR_TREE_LIST; TYPE.SYMBOL]] `alias Union[[TRANSIENT] Collection[VAR_TREE_LIST; TYPE.SYMBOL]]
```
## Tag Example
@@ -37,22 +39,16 @@ u : Tag[I64.a; I64.b; I64.c] $ (.c : 5)
# 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
-Transient_generic[Generic.T] `alias Union[[TRANSIENT_GENERIC] Generic.T.value]
-
-Result[Generic.T] `alias Union[[TRANSIENT] Generic.T.value; Error.error]
-
-Option[Generic.T] `alias Union[[TRANSIENT] Generic.T.value; Void.null]
-
-Next[Generic.T] `alias Union[[TRANSIENT] Generic.T.value; Void.done]
-
-Next_result[Generic.T] `alias Union[[TRANSIENT] Generic.T.value; Error.error; Void.done]
+Result[Generic.T] `alias Transient[Generic.T.value; Void.null; Error.error]
-Next_option[Generic.T] `alias Union[[TRANSIENT] Generic.T.value; Void.null; Void.done]
+Iteration[Generic.T] `alias Transient[Generic.T.value; Void.null; Void.done; Error.error]
```
## Default Operation
diff --git a/mkdocs.yml b/mkdocs.yml
index 0fdd5e3..cef73c6 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -59,3 +59,7 @@ nav:
- Life Cycle:
- Register: 'lifecycle/register.md'
- Parse: 'lifecycle/parse.md'
+ - Scope: 'lifecycle/scope.md'
+ - Import: 'lifecycle/import.md'
+ - Check: 'lifecycle/check.md'
+ - Eval: 'lifecycle/eval.md'