diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/application/buffer.md | 7 | ||||
| -rw-r--r-- | docs/application/index.md | 20 | ||||
| -rw-r--r-- | docs/application/interface.md | 4 | ||||
| -rw-r--r-- | docs/application/memory.md | 6 | ||||
| -rw-r--r-- | docs/application/namespace.md | 3 | ||||
| -rw-r--r-- | docs/application/shared.md | 3 | ||||
| -rw-r--r-- | docs/application/testing.md | 8 | ||||
| -rw-r--r-- | docs/application/thread.md | 7 | ||||
| -rw-r--r-- | docs/lifecycle/check.md | 3 | ||||
| -rw-r--r-- | docs/lifecycle/eval.md | 3 | ||||
| -rw-r--r-- | docs/lifecycle/import.md | 3 | ||||
| -rw-r--r-- | docs/lifecycle/parse.md | 32 | ||||
| -rw-r--r-- | docs/lifecycle/register.md | 6 | ||||
| -rw-r--r-- | docs/lifecycle/scope.md | 15 | ||||
| -rw-r--r-- | docs/type_system/bit.md | 4 | ||||
| -rw-r--r-- | docs/type_system/function.md | 21 | ||||
| -rw-r--r-- | docs/type_system/list.md | 4 |
17 files changed, 108 insertions, 41 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 887f7f7..790c155 100644 --- a/docs/application/interface.md +++ b/docs/application/interface.md @@ -45,11 +45,11 @@ typedef enum : uint8_t { KPL_STATUS_ERROR, KPL_STATUS_NULL, KPL_STATUS_VALUE -} kpl_status; +} kpl_result_status; typedef struct { any value; - kpl_status status; + kpl_result_status status; } kpl_result; kpl_result kpl_result_error(error *er); 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/function.md b/docs/type_system/function.md index 78abdf7..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 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; ``` |
