diff options
Diffstat (limited to 'docs/language')
| -rw-r--r-- | docs/language/index.md | 225 | ||||
| -rw-r--r-- | docs/language/operators.md | 99 | ||||
| -rw-r--r-- | docs/language/ownership.md | 44 |
3 files changed, 0 insertions, 368 deletions
diff --git a/docs/language/index.md b/docs/language/index.md deleted file mode 100644 index 1f50a17..0000000 --- a/docs/language/index.md +++ /dev/null @@ -1,225 +0,0 @@ -# Code - ---- - -Code is encoded as UTF-8, allowed glyphs are: - -```text -abcdefghijklmnopqrstuvwxyz -ABCDEFGHIJKLMNOPQRSTUVWXYZ -0123456789 -`~!@#$%^&*()-_=+{}[]\|;:'"<>,.?/ -\s\t\n -``` - -# Comments - -```text -// This is a comment until the end of the line - -/* Comment block */ -``` - -# Atoms - -## Number Literals - -```text -12 // Decimal -``` - -##### Integer - -```text -0x12 // Hex -0b10 // Binary -0o75 // Octal -``` - -##### Float - -```text -1.2 -1e6 -``` - -Underscores `_` can separate digits in a number - -```text -100_000 -1.100_000 -1_ // Invalid -``` - -## String and Char Literals - -```text -"Asdf\n" -'A' -``` - -### String literals have a `2 ^ 16 - 2` token byte limit - -### Char literals have a `6` token byte limit - -Any UTF-8 glyph is allowed between `""` or `''` - -```text -Ω // Invalid code -"Ω" // Valid code -'Ω' // Valid code -``` - -## Variable Names - -Start with a lowercase letter - -Variables starting with `_` are treated as unused - -### Variables names have a 50 character limit - -## Type Names - -Start with an uppercase letter created with either \`alias or \`unique - -### Type names have a 50 character limit - -## Type Qualifiers - -Start with `%` - -# Operators - -Represented as an symbol or a keyword starting with \` - -```text -1 + 2 -1 `add 2 -``` - -## Operator Conventions - -```text -`operator FIRST - -FIRST `operator SECOND - -FIRST `operator (REST; ...) - -`operator (FIRST; REST; ...) -``` - -# Symbols - -Start with a `.` - -```test -.symbol -``` - -### Symbols have a 50 character limit - -# Lists - -A list of statements between `()` separated by `;` or `\n` - -```text -(1; 2; 3) -``` - -# Definitions - -A list of definitions between `[]` separated by `;` or `\n` - -```text -Type[arg] -``` - -## Destructuring - -Take values out of a collection - -```text -target [VAR_NAME.TARGET_NAME] -target [VAR_NAME] // Resolves to VAR_NAME.VAR_NAME -target [VAR_NAME_AT_INDEX] -``` - -### Destructuring Example with Indexes - -```text -v : Tuple $ (1; 2; 3) -v [a; b; c] -`log a // I64.a $ 1 -`log b // I64.b $ 2 -`log c // I64.c $ 3 -``` - -# Actions - -A list of statements between `{}` separated by `;` or `\n` associated with a conditional - -Arguments are specified with a `[]` at the beginning of the `{}` - -## Conditionals - -### Loop `@` - -```text -@ condition { statements } - -@ condition {[args] statements } - -@ (value; condition; increment) {[value] statements } - -@.name condition { statements } - -@.name condition {[args] statements } -``` - -#### ``break` `break .name` - -Stops a loop - -```text -@.a 1 .. 5 {[x] - @.b 1 .. 5 {[y] - ? x = y { `break .a } - } -} -``` - -#### ``continue` `continue .name` - -Move loop to next iteration - -### If `?` - -```text -? condition { statements } - -? condition { true statements } { false statements } - -? { - condition { statements } - { default statements } -} - -? condition {[arg] statements } -``` - -### Match `#` - -```text -# match { - target { statements } - target {[arg] statements } - { default statements } -} -``` - -### Mutation `^` - -```test -^ mutation {[arg] statements } -``` diff --git a/docs/language/operators.md b/docs/language/operators.md deleted file mode 100644 index 2b843ec..0000000 --- a/docs/language/operators.md +++ /dev/null @@ -1,99 +0,0 @@ -# General Operators - ---- - -## Assign `:` - -## Shadow `::` - -## Cast `$` - -```c -typedef kpl_result kpl_interface_cast(kpl_type to, const kpl_any from); -``` - -## ``log` - -Configurable logger, destination can be changed - -```c -typedef void kpl_interface_log(kpl_type type, const kpl_any any, const FILE *file, int32_t idnt, uint32_t options); -``` - -## ``debugger` - -## ``thread_id` - -```text -Thread_id `unique I32 -``` - -## ``thread_count` - -## ``format` - -```text -Result[String] : Value[String]`format Any -``` - -### Formatting - -#### Replace - -Use `%` to indicate an item from `Any`, use `\%` for a literal `%` - -#### Colors - -Use `#NAME#` to change the text color, use `#` to reset the text color, use `\#` for a literal `#` - -```text -BOLD -FAINT -ITALIC -UNDERLINE - UL - -BACKGROUND - BG -LIGHT - -BLACK -RED -GREEN -YELLOW -BLUE -MAGENTA -CYAN -GREY -WHITE -``` - -`#NAME#NAME#` use single `#` to apply multiple colors at once - -```c -typedef kpl_result kpl_interface_format(const kpl_buffer *format, [const kpl_any]..., NULL); -``` - -## ``panic` - -Stops execution and prints `Any` to `stdout` - -```text -`panic any -``` - -## ``type` - -## ``sync_type` - -## ``async_type` - -## ``copy` - -```c -typedef kpl_result kpl_interface_copy(const kpl_any any); -``` - -## ``hash` - -```c -typedef uint64_t kpl_interface_hash(const kpl_any any); -``` diff --git a/docs/language/ownership.md b/docs/language/ownership.md deleted file mode 100644 index 26eebe1..0000000 --- a/docs/language/ownership.md +++ /dev/null @@ -1,44 +0,0 @@ -# Ownership - ---- - -# Copying - -## Assignment - -# Moving - -## Assignment is not allowed for movable types that are not shared - -## To And From Functions - -# Passing - -## References - -References are automatically taken if the function signature specifies ref - -```text -int_array : Array[I64] $ () -float_array : Array[F64] $ () -@ 0 .. 2 {[x] - ([%ref x; y] x `push y + 1) `sync (int_array, x) - ([%ref x; y] x `push y + 1) `sync (float_array, F64 $ x) -} -`log int_array // Array[I64] $ (1; 2; 3) -`log float_array // Array[F64] $ (1.0; 2.0; 3.0) -``` - -#### Functions that take references cannot be called with ``async` - -# Shared Types - -# Locking - -Prevent modification until a mutation occurs - -## References - -# Mutating - -Unlock a lock or shared target and prevents modification to everything except the lock target |
