From b26ad08b39b8229dcea0bafc4a8ba4b0d7ad7154 Mon Sep 17 00:00:00 2001 From: nodist Date: Tue, 2 Jun 2026 16:26:09 -0400 Subject: reformat with sync and async calls --- docs/language/index.md | 168 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 docs/language/index.md (limited to 'docs/language/index.md') diff --git a/docs/language/index.md b/docs/language/index.md new file mode 100644 index 0000000..fe97143 --- /dev/null +++ b/docs/language/index.md @@ -0,0 +1,168 @@ +# 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 +``` + +## String Literals + +```text +"Asdf\n" +``` + +Any UTF-8 glyph is allowed between `""` + +```text +Ω // Invalid code +"Ω" // Valid code +``` + +## Variable Names + +Start with a lowercase letter + +Variables starting with `_` are treated as unused + +## Type Names + +Start with an uppercase letter created with either \`alias or \`unique + +# 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 +``` + +# Lists + +A list of statements between `()` separated by `;` or `\n` + +```text +(1; 2; 3) +``` + +# Definitions + +A list of type definitions between `[]` separated by `;` or `\n` + +```text +Type[arg] +``` + +# 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 } + +@ condition {[.name] statements } + +@ condition {[.name; args] statements } +``` + +#### If `?` + +```text +? condition { statements } + +? { + condition { statements } + { default statements } +} + +? condition {[arg] arg; .... } +``` + +#### Match `#` + +```text +# match { + target { statements } + target {[args] statements } + { default statements } +} +``` + +#### Mutation `^` + +```test +^ mutation {[args] statements } +``` -- cgit v1.2.3