From db5ae642219e222e07d47614d7e602371b21aec2 Mon Sep 17 00:00:00 2001 From: nodist Date: Sun, 6 Sep 2026 16:28:59 -0400 Subject: start impl --- docs/allocator.md | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ docs/containers.md | 66 ++++++++++++++++++++++++++++-------------------------- docs/coroutines.md | 22 +++++++++--------- docs/index.md | 8 ++++--- docs/io.md | 3 +++ docs/objectives.md | 34 ++++++++++++++-------------- docs/syntax.md | 2 +- docs/tagging.md | 4 ++-- docs/values.md | 40 ++++++++++++++++++++++++--------- 9 files changed, 167 insertions(+), 77 deletions(-) create mode 100644 docs/allocator.md create mode 100644 docs/io.md (limited to 'docs') diff --git a/docs/allocator.md b/docs/allocator.md new file mode 100644 index 0000000..5885d76 --- /dev/null +++ b/docs/allocator.md @@ -0,0 +1,65 @@ +# Allocator + +--- + +KPL uses `mmap` to allocate slabs of non-executable and executable memory + +Once memory is used it is not returned to the OS until KPL exits + +## Non-Executable + +### Mapping + +Two linked list of pages is kept, tracing the size of map and how much is used: + +#### Small Page Allocator + +For allocations less then a page size `< 2 ^ 12` + +#### Large Page Allocator + +For allocations a page size or larger `>= 2 ^ 12` + +### Object Sizes + +Every Object KPL allocates is sized to the next power of 2 + +Because each power of two requires its own ring buffer, minimum allocation size is `2 ^ 6` and max is `2 ^ 27` + +### Ring Buffer Sizes + +The total number of objects each ring buffer can store can by modified by MACRO'S at compile time + +The program will exit if more objects are allocated then it's corresponding ring buffer can hold + +### Ring Buffer Implementation + +Each ring buffer is implemented as an atomic multi-producer multi-consumer queue + +### Operation + +#### Constructor + +#### Requesting Objects + +#### Returning Objects + +#### Destructor + +## Executable + +### Mapping + +A linked list of pages is kept, tracing the size of each map and how much is used + +### Operation + +#### Constructor + +#### Requesting Memory + +#### Writing To Memory + +#### Making Memory Executable + +#### Destructor diff --git a/docs/containers.md b/docs/containers.md index f05138e..2a79d61 100644 --- a/docs/containers.md +++ b/docs/containers.md @@ -8,15 +8,15 @@ * `,` -* ``length` +* ```length`` -* ``reverse` +* ```reverse`` -* ``split` +* ```split`` -* ``join` +* ```join`` -* ``log` +* ```log`` ### `[]` @@ -28,21 +28,21 @@ * `,` -* ``length` +* ```length`` -* ``reverse` +* ```reverse`` -* ``push` +* ```push`` -* ``pop` +* ```pop`` -* ``map` +* ```map`` -* ``filter` +* ```filter`` -* ``reduce` +* ```reduce`` -* ``log` +* ```log`` ### `[]` @@ -54,7 +54,7 @@ ### Operators -* ``log` +* ```log`` ### `[]` @@ -64,7 +64,7 @@ ### Operators -* ``log` +* ```log`` ### Tags @@ -74,13 +74,13 @@ ### Operators -* ``size` +* ```size`` -* ``has` +* ```has`` -* ``remove` +* ```remove`` -* ``log` +* ```log`` ### `[]` @@ -88,19 +88,19 @@ ### Operators -* ``size` +* ```size`` -* ``has` +* ```has`` -* ``remove` +* ```remove`` -* ``log` +* ```log`` ## Union ### Operators -* ``log` +* ```log`` ### Tags @@ -110,7 +110,7 @@ ### Operators -* ``log` +* ```log`` ### `#` @@ -118,25 +118,27 @@ ### Operators -* ``log` +* ```log`` ## Error +Errors are read only, data can only be copied from them + ### Operators * `$` -* ``log` +* ```log`` ## Module ### Operators -* ``export` +* ```export`` -* ``import` +* ```import`` -* ``log` +* ```log`` ### De-structuring @@ -144,8 +146,8 @@ ### Operators -* ``use` +* ```use`` -* ``log` +* ```log`` ### De-structuring diff --git a/docs/coroutines.md b/docs/coroutines.md index 9a64894..b06922e 100644 --- a/docs/coroutines.md +++ b/docs/coroutines.md @@ -6,29 +6,29 @@ ### Operators -* ``return` +* ```return`` -* ``sync` +* ```sync`` -* ``async` +* ```async`` -* ``await` +* ```await`` -* ``log` +* ```log`` ## Generators ### Operators -* ``yield` +* ```yield`` -* ``stop` +* ```stop`` -* ``init` +* ```init`` -* ``next` +* ```next`` -* ``log` +* ```log`` ## Regular Expressions @@ -36,4 +36,4 @@ * `~` -* ``log` +* ```log`` diff --git a/docs/index.md b/docs/index.md index 9766a42..3f08671 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,9 +1,11 @@ # Kevin's Programming Language (KPL) Specification +Version 0.0.0 + --- -Version 0.0.0 +## Overview -This is the specification of the language and its implementation. +KPL is a high level, asynchronous, garbage collected, just in time, programming language. -The documentation on how to use the language will be posted somewhere else +This document describes the design of the language and how it is implemented. diff --git a/docs/io.md b/docs/io.md new file mode 100644 index 0000000..df8254d --- /dev/null +++ b/docs/io.md @@ -0,0 +1,3 @@ +# IO + +--- diff --git a/docs/objectives.md b/docs/objectives.md index 313b3f6..efb90b7 100644 --- a/docs/objectives.md +++ b/docs/objectives.md @@ -2,36 +2,36 @@ --- -### Implicit Error Handling +## Implicit Error Handling -* All operations return a `Result` that can be manually or automatically checked +All operations return a `Result` that can be manually or automatically checked -### Asynchronous First +## Asynchronous First -* No functions, only coroutines +No functions, only coroutines -### All Code Is Thread Safe +## All Code Is Thread Safe -* Values are atomic and all containers have a `mutex` like mechanism that is implicitly locked before use +Values are atomic and all containers have a `mutex` like mechanism that is implicitly locked before use -### Strongly Typed +## Strongly Typed -* Dynamic types are represented by `Any`, these types have to be matched to a type before they can be used +Dynamic types are represented by `Any`, these types have to be matched to a type before they can be used -### Single Invocation +## Single Invocation -* Just In Time Compilation +Just In Time Compilation -### Asymmetric C Interoperability +## Asymmetric C Interoperability -* KPL code can call C code, C code can call certain KPL code +KPL code can call C code, C code can call certain KPL code -### Minimal Dependencies +## Minimal Dependencies -* Run On Linux With `io_uring` For `X86-64` (X64) And `Aarch64` (A64) Only +Run On Linux With `io_uring` For `X86-64` (X64) And `Aarch64` (A64) Only -* GCC, Make and OpenSSL; should compile on *most* distributions without any extra steps +GCC, Make and OpenSSL; should compile on *most* distributions without any extra steps -### Low Resource Usage +## Low Resource Usage -* Should work on servers with 1 Core and 1 Gigabyte of RAM +Should work on servers with 1 Core and 1 Gigabyte of RAM diff --git a/docs/syntax.md b/docs/syntax.md index 73da567..1c28324 100644 --- a/docs/syntax.md +++ b/docs/syntax.md @@ -44,7 +44,7 @@ 1 + 2 ``` -### Named ``[a-z]\w+` +### Named ```[a-z]\w+`` ## Variables `[a-z][a-zA-Z0-9_]{0,49}` diff --git a/docs/tagging.md b/docs/tagging.md index b7c0700..2c392d8 100644 --- a/docs/tagging.md +++ b/docs/tagging.md @@ -47,7 +47,7 @@ mu : `{[Bool i] ```text // using the mu corotuine from above -i : # mu `sync `false { +i : # mu `sync `true { .int {[i] i } .float {[f] I64 f } } @@ -70,7 +70,7 @@ gen : ^{[I64 n] `yield x // above is alias for -> `yield.value x } - `done + // stopping is implicit, use `stop to explicitly end iterator } it : gen `init 10 diff --git a/docs/values.md b/docs/values.md index c25be77..b06c3cb 100644 --- a/docs/values.md +++ b/docs/values.md @@ -18,11 +18,11 @@ * `|` -* ``true` +* ```true`` -* ``false` +* ```false`` -* ``log` +* ```log`` ## Numbers @@ -76,17 +76,17 @@ * ``~` -* ``^` +* ```^`` -* ``&` +* ```&`` -* ``|` +* ```|`` -* ``<<` +* ```<<`` -* ``>>` +* ```>>`` -* ``log` +* ```log`` ### Float @@ -124,7 +124,7 @@ * `%` -* ``log` +* ```log`` ## Characters @@ -132,4 +132,22 @@ ### Operators -* ``log` +* `!` + +* `=` + +* `!=` + +* `<` + +* `<=` + +* `>` + +* `>=` + +* `&` + +* `|` + +* ```log`` -- cgit v1.2.3