diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-06-17 14:24:51 -0400 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-06-17 14:24:51 -0400 |
| commit | 1ccb3c92a4c074a12550c584d3651ace2d7c0131 (patch) | |
| tree | 3288fc8f7b6bb9e31fe43cfbd3d5e18e61d0207e /docs | |
| parent | 7964cf08ac807ac9e7b6d579a25321a23adc9139 (diff) | |
qualifiers as %
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/application/index.md | 4 | ||||
| -rw-r--r-- | docs/application/mutex.md | 3 | ||||
| -rw-r--r-- | docs/application/native.md | 2 | ||||
| -rw-r--r-- | docs/application/shared.md | 2 | ||||
| -rw-r--r-- | docs/application/thread.md | 9 | ||||
| -rw-r--r-- | docs/language/index.md | 3 | ||||
| -rw-r--r-- | docs/language/ownership.md | 2 | ||||
| -rw-r--r-- | docs/type_system/bit.md | 2 | ||||
| -rw-r--r-- | docs/type_system/const.md | 2 | ||||
| -rw-r--r-- | docs/type_system/empty.md | 4 | ||||
| -rw-r--r-- | docs/type_system/function.md | 6 | ||||
| -rw-r--r-- | docs/type_system/ref.md | 2 | ||||
| -rw-r--r-- | docs/type_system/select.md | 6 | ||||
| -rw-r--r-- | docs/type_system/shared.md | 10 |
14 files changed, 37 insertions, 20 deletions
diff --git a/docs/application/index.md b/docs/application/index.md index be3d621..b89d79f 100644 --- a/docs/application/index.md +++ b/docs/application/index.md @@ -36,7 +36,9 @@ ### Module -### String/REPL +### String + +### REPL 1. ##### Parse 2. ##### Scan diff --git a/docs/application/mutex.md b/docs/application/mutex.md index 999f5dc..e1b15c7 100644 --- a/docs/application/mutex.md +++ b/docs/application/mutex.md @@ -6,7 +6,7 @@ ```c typedef struct { - kpl_atomic_queue queue; + kpl_task_queue queue; _Atomic int32_t lock; } kpl_mutex; ``` @@ -20,4 +20,5 @@ typedef struct { ### Mutex Task 1. Get task from `queue` and run task + * Use spinlock with `pasue`, the `lock` will be set before the task is added to the `queue` 2. After task completion, do `value = --lock`, stop if `value` is `0`, otherwise repeat diff --git a/docs/application/native.md b/docs/application/native.md index 9d4b917..8cd8f82 100644 --- a/docs/application/native.md +++ b/docs/application/native.md @@ -2,6 +2,8 @@ --- +## Object Definitions + ```c typedef struct _kpl_native { KPL_SLAB_HEADER(_kpl_native); diff --git a/docs/application/shared.md b/docs/application/shared.md index 95616c9..88026f9 100644 --- a/docs/application/shared.md +++ b/docs/application/shared.md @@ -7,7 +7,7 @@ ```c typedef struct _kpl_shared { KPL_SLAB_HEADER(_kpl_shared); - void *data; + kpl_class data; kpl_mutex mutex; bool mark; } kpl_shared; diff --git a/docs/application/thread.md b/docs/application/thread.md index 231b0fe..2f85a67 100644 --- a/docs/application/thread.md +++ b/docs/application/thread.md @@ -9,12 +9,15 @@ typedef struct _kpl_task kpl_task; typedef void kpl_task_fn(kpl_task *t); +#define KPL_TASK_STATE_SIZE 32 + typedef struct _task { task *_Atomic next, *join; - kpl_group *state; + kpl_class state[KPL_TASK_STATE_SIZE]; kpl_result return_value; task_fn *fn; int32_t thread_id; + int16_t state_length; _Atomic bool join_ready; } task; @@ -35,10 +38,10 @@ typedef struct { struct { kpl_task *_Atomic next; } dummy; -} kpl_atomic_queue; +} kpl_task_queue; typedef struct { - kpl_atomic_queue queue; + kpl_task_queue queue; _Atomic ssize_t priority; kpl_task_slab *slab; kpl_task *pool; diff --git a/docs/language/index.md b/docs/language/index.md index ee2ea70..371ecf1 100644 --- a/docs/language/index.md +++ b/docs/language/index.md @@ -48,6 +48,7 @@ Underscores `_` can separate digits in a number ```text 100_000 1.100_000 +1_ // Invalid ``` ## String Literals @@ -179,6 +180,8 @@ Move loop to next iteration ```text ? condition { statements } +? condition { true statements } { false statements } + ? { condition { statements } { default statements } diff --git a/docs/language/ownership.md b/docs/language/ownership.md index db48c6a..76f28ae 100644 --- a/docs/language/ownership.md +++ b/docs/language/ownership.md @@ -19,7 +19,7 @@ References are automatically taken if the function signature specifies ref ```text -inc_push_to_ref : ([`ref x; y] +inc_push_to_ref : ([%ref x; y] x `push y + 1 ) int_array : Array[I64] $ () diff --git a/docs/type_system/bit.md b/docs/type_system/bit.md index 11cecef..a1391ff 100644 --- a/docs/type_system/bit.md +++ b/docs/type_system/bit.md @@ -59,7 +59,7 @@ Bool `alias Bit[[BIT8 | BOOL]] ### Div `/` -### Mod `%` +### Mod ``mod` ### ``exp` diff --git a/docs/type_system/const.md b/docs/type_system/const.md index 2d818de..3966009 100644 --- a/docs/type_system/const.md +++ b/docs/type_system/const.md @@ -5,5 +5,5 @@ Cannot be changed or mutated ```text -`const +%const ``` diff --git a/docs/type_system/empty.md b/docs/type_system/empty.md index 08b0977..7997901 100644 --- a/docs/type_system/empty.md +++ b/docs/type_system/empty.md @@ -5,7 +5,7 @@ Container type can be null ```text -`empty +%empty ``` ## Use with `Option` Union @@ -17,7 +17,7 @@ make_array : ([yes] `nome } ) -v : make_array(...) // `empty Array[I64] $ .none OR `empty Array[I64] $ (.some : (1; 2; 3)) +v : make_array(...) // %empty Array[I64] $ .none OR %empty Array[I64] $ (.some : (1; 2; 3)) # v { .some {[x] `log x } // Array[I64] $ (1; 2; 3) .none { ... } diff --git a/docs/type_system/function.md b/docs/type_system/function.md index 814e3c3..57b0abf 100644 --- a/docs/type_system/function.md +++ b/docs/type_system/function.md @@ -95,6 +95,8 @@ it : fn `sync 10 } ``` +## Range `..` + # Calling ## \`async @@ -115,3 +117,7 @@ If the callee is a process, an inline await with async is used ```text fn `sync args // can be turned into `await fn `async args ``` + +# Binding + +## \`bind diff --git a/docs/type_system/ref.md b/docs/type_system/ref.md index e47367f..7eea6aa 100644 --- a/docs/type_system/ref.md +++ b/docs/type_system/ref.md @@ -3,7 +3,7 @@ --- ```text -`ref +%ref ``` A reference, cannot be assigned diff --git a/docs/type_system/select.md b/docs/type_system/select.md index 979e9d1..73e7953 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[.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[.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[.symbol : %const Value]] ``` ## Definition Example diff --git a/docs/type_system/shared.md b/docs/type_system/shared.md index 9ddef26..dcb31d5 100644 --- a/docs/type_system/shared.md +++ b/docs/type_system/shared.md @@ -5,7 +5,7 @@ Hold multiple references to the same object ```text -`shared +%shared ``` # Garbage Collection @@ -15,11 +15,11 @@ A tracing mark and sweep garbage collector is used # Mutating ```text -x : `shared Array $ (1; 2; 3) +x : %shared Array $ (1; 2; 3) ^ x {[y] y `push 4 } -`log x // `shared Array[I64] $ (1; 2; 3; 4) +`log x // %shared Array[I64] $ (1; 2; 3; 4) ``` # Operators @@ -31,8 +31,8 @@ x : `shared Array $ (1; 2; 3) ### Example sharing data between two shared objects ```text -x : `shared 1 -y : `shared 0 +x : %shared 1 +y : %shared 0 z : ^ x {[x] x } ^ y {[y] y : z } |
