diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-06-04 17:22:25 -0400 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-06-04 17:22:25 -0400 |
| commit | 1d5f5dd3cd5cc07352379fe33930770e3d203f3a (patch) | |
| tree | 9a92bdf7a34b99065d8f67f296b86743d34b2b84 /docs | |
| parent | a8810a00d95678cceee2a063df9c094fa6f6037d (diff) | |
use await and more application definitions
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/application/buffer.md | 14 | ||||
| -rw-r--r-- | docs/application/index.md | 30 | ||||
| -rw-r--r-- | docs/application/interface.md | 9 | ||||
| -rw-r--r-- | docs/application/map.md | 3 | ||||
| -rw-r--r-- | docs/application/namespace.md | 60 | ||||
| -rw-r--r-- | docs/application/pool.md | 4 | ||||
| -rw-r--r-- | docs/application/queue.md | 3 | ||||
| -rw-r--r-- | docs/application/thread.md | 15 | ||||
| -rw-r--r-- | docs/application/tuple.md | 13 | ||||
| -rw-r--r-- | docs/index.md | 12 | ||||
| -rw-r--r-- | docs/type_system/bit.md | 4 | ||||
| -rw-r--r-- | docs/type_system/fn.md | 6 | ||||
| -rw-r--r-- | docs/type_system/namespace.md | 4 | ||||
| -rw-r--r-- | docs/type_system/task.md | 4 |
14 files changed, 143 insertions, 38 deletions
diff --git a/docs/application/buffer.md b/docs/application/buffer.md new file mode 100644 index 0000000..d72eb8a --- /dev/null +++ b/docs/application/buffer.md @@ -0,0 +1,14 @@ +# Buffer + +--- + +## Object Definitions + +```c +typedef struct _kpl_buffer { + POOL_HEADER(_kpl_buffer); + uint32_t byte_length; + kpl_interface *interface; + uint8_t bytes; +} kpl_buffer; +``` diff --git a/docs/application/index.md b/docs/application/index.md index e7e719f..7d97cda 100644 --- a/docs/application/index.md +++ b/docs/application/index.md @@ -6,7 +6,7 @@ * Linux X64 * GNU Make -* GCC with -std=gnu99 -fhardened +* GCC with -std=gnu99 -fhardened (14+) # Sections @@ -14,6 +14,10 @@ * ##### [Type](./type.md) * ##### [Pool](./pool.md) * ##### [Thread](./thread.md) +* ##### [Tuple](./tuple.md) +* ##### [Buffer](./buffer.md) +* ##### [Map](./map.md) +* ##### [Queue](./queue.md) * ##### [Namespace](./namespace.md) * ##### [Testing](./testing.md) @@ -21,22 +25,20 @@ ## Startup -```c -void kpl_init(void); -``` - ## Main -```c -void kpl_main(int argc, char *argv[]); -``` +### File -## File +### String/REPL -## REPL +## Evaluation -## Shutdown +1. ##### Scan +2. ##### Parse +3. ##### Scope +4. ##### Check +5. ##### Eval +6. ##### Jit +7. ##### Exec -```c -void kpl_free(void) -``` +## Shutdown diff --git a/docs/application/interface.md b/docs/application/interface.md index 3f270bd..5042bb4 100644 --- a/docs/application/interface.md +++ b/docs/application/interface.md @@ -33,6 +33,15 @@ typedef int32_t kpl_any_print_fn(const kpl_any a, FILE *file, size_t idnt, uint3 typedef void kpl_any_free_fn(kpl_any a); typedef struct { + // TODO +} kpl_interface; + +typedef struct { + kpl_any *any; + kpl_interface *interflace; +} kpl_class; + +typedef struct { any value, info; } kpl_result; ``` diff --git a/docs/application/map.md b/docs/application/map.md new file mode 100644 index 0000000..b9d8fa0 --- /dev/null +++ b/docs/application/map.md @@ -0,0 +1,3 @@ +# Map + +--- diff --git a/docs/application/namespace.md b/docs/application/namespace.md index 47f6105..f49ebf1 100644 --- a/docs/application/namespace.md +++ b/docs/application/namespace.md @@ -4,10 +4,62 @@ ## Object Definitions -# Native Registering +```c +typedef struct _kpl_native_namespace { + POOL_HEADER(_kpl_native_namespace); + kpl_buffer *name; + kpl_map *exports; + pthread_mutex_t mutex; +} kpl_native_namespace; +``` -# File Registering +```c +typedef struct _kpl_file_namespace { + POOL_HEADER(_kpl_file_namespace); + __Atomic int16_t children; + uint16_t flags; + kpl_buffer *file_name, *file_string; + kpl_map *parents, *exports; + // TODO AST + kpl_interface *interface; + kpl_task *task; + pthread_mutex_t mutex; +} kpl_file_namespace; +``` -## Import +```c +typedef struct _kpl_string_namespace { + kpl_buffer *string; + // TODO AST + kpl_interface *interface; + kpl_task *task; +} kpl_string_namespace; +``` -## Export +# Registering + +## Native + +## File + +### Main + +### ``import` + +## String/REPL + +# Updating + +## File + +### ``export` + +# Using + +## Native + +### ``use` + +## File + +### ``import` diff --git a/docs/application/pool.md b/docs/application/pool.md index b4c5913..a73dd82 100644 --- a/docs/application/pool.md +++ b/docs/application/pool.md @@ -11,3 +11,7 @@ typedef struct _kpl_pool_obj { POOL_HEADER(_kpl_pool_obj); } kpl_pool_obj; ``` + +## List Management + +## Tree Management diff --git a/docs/application/queue.md b/docs/application/queue.md new file mode 100644 index 0000000..86c4009 --- /dev/null +++ b/docs/application/queue.md @@ -0,0 +1,3 @@ +# Queue + +--- diff --git a/docs/application/thread.md b/docs/application/thread.md index a11c01f..4ee5688 100644 --- a/docs/application/thread.md +++ b/docs/application/thread.md @@ -17,9 +17,10 @@ typedef struct _kpl_task { POOL_HEADER(kpl_task); _Atomic bool join_ready; uint16_t worker_id; - kpl_any state[KPL_TASK_STATE_SIZE]; - kpl_result ret; kpl_task_fn *fn; + kpl_interface *ret_interface; + kpl_result ret; + kpl_class state[KPL_TASK_STATE_SIZE]; } kpl_task; typedef struct { @@ -27,9 +28,11 @@ typedef struct { pthread_t thread; } kpl_thread; -#define KPL_THREADS $(nproc) +#define KPL_MAX_THREADS 64 + +uint16_t available_threads; // find with sched_getaffinity -_Atomic uint16_t running; // init to KPL_THREADS +_Atomic uint16_t running_threads; // init to available_threads kpl_task *async_queue_head, *async_queue_tail; @@ -37,7 +40,7 @@ pthread_mutex_t async_mutex; pthread_cond_t async_cond; -kpl_thread threads[KPL_THREADS]; +kpl_thread threads[KPL_MAX_THREADS]; ``` ## Per Process Task Queue @@ -244,7 +247,7 @@ fib : Fn[n] $ ( } v : Array[`fork_type fib] $ () @ 1 .. I { v `push fib `async FIB } - @ v {[fib_task] `print "fib(%) = %\n" `format (FIB; `wait fib_task) } + @ v {[fib_task] `print "fib(%) = %\n" `format (FIB; `await fib_task) } `print "Complete\n" ) */ diff --git a/docs/application/tuple.md b/docs/application/tuple.md new file mode 100644 index 0000000..e0e926c --- /dev/null +++ b/docs/application/tuple.md @@ -0,0 +1,13 @@ +# Tuple + +--- + +## Object Definitions + +```c +typedef struct _kpl_tuple { + POOL_HEADER(_kpl_tuple); + uint32_t item_length; + kpl_class items[]; +} kpl_tuple; +``` diff --git a/docs/index.md b/docs/index.md index 389b7a8..b0b2baa 100644 --- a/docs/index.md +++ b/docs/index.md @@ -22,17 +22,19 @@ This specification not only describes the language syntax but it's implementatio * Automatically use threads -* All code can be run asynchronously - -* No built in asynchronous callback functions +* All code can be run asynchronously, no built in asynchronous callback functions ```text +// Do Soemthing readFile("filename", callback(data)) +// Continue while readFile is running // langauge equivalent +// Do Soemthing Fn[name; callback] $ ( - ( read_file ) : `use "io" - callback `sync read_file `sync name + ( read ) : `use "io" + callback `sync read `sync name ) `async ("filename"; callback) +// Continue while readFile is running ``` * C interoperability diff --git a/docs/type_system/bit.md b/docs/type_system/bit.md index b474156..5f7aa8e 100644 --- a/docs/type_system/bit.md +++ b/docs/type_system/bit.md @@ -2,10 +2,10 @@ --- -A sequence of bits that can fit into a register +A sequence of bits that can fit into a general register ```text -Bit_size `alias Enum[.bit_any; .bit8; .bit16; .bit32; .bit64; .bit80; .bit128] +Bit_size `alias Enum[.bit_any; .bit8; .bit16; .bit32; .bit64] Bit_representation `alias Enum[ .numeric; .int; .int_unsiged; .int_signed; .float diff --git a/docs/type_system/fn.md b/docs/type_system/fn.md index b004560..66a350e 100644 --- a/docs/type_system/fn.md +++ b/docs/type_system/fn.md @@ -91,15 +91,15 @@ Asynchronous call ```text task : `async fn -value : `wait task +value : `await task ``` ## \`sync Synchronous call -If the callee is a process, an inline wait with async is used +If the callee is a process, an inline await with async is used ```text -fn `sync args // can be turned into `wait fn `async args +fn `sync args // can be turned into `await fn `async args ``` diff --git a/docs/type_system/namespace.md b/docs/type_system/namespace.md index 44483bc..f38e8ab 100644 --- a/docs/type_system/namespace.md +++ b/docs/type_system/namespace.md @@ -20,13 +20,13 @@ A file with code ### \`import ```text -Namespace : `import Const[String] +Namespace : `import Value[String] ``` ### \`use ```text -Namespace : `use Const[String] +Namespace : `use Value[String] ``` ## Main diff --git a/docs/type_system/task.md b/docs/type_system/task.md index 06790d7..33879b6 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[JOIN_TYPE; PROCESS] +Task[TYPE; FN] ``` -## \`wait +## \`await |
