diff options
Diffstat (limited to 'docs/language')
| -rw-r--r-- | docs/language/index.md | 168 | ||||
| -rw-r--r-- | docs/language/operators.md | 71 | ||||
| -rw-r--r-- | docs/language/ownership.md | 13 |
3 files changed, 252 insertions, 0 deletions
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 } +``` diff --git a/docs/language/operators.md b/docs/language/operators.md new file mode 100644 index 0000000..d8ae378 --- /dev/null +++ b/docs/language/operators.md @@ -0,0 +1,71 @@ +# General Operators + +--- + +## Assign `:` + +## Shadow `::` + +## Cast `$` + +## ``print` + +```text +Result[I32] : Is[File; Void] `print Any +``` + +If no `File` is specified the output is send to `stdout` + +## ``format` + +```text +Result[String] : Const[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 + +## ``panic` + +Stops execution and prints `Any` to `stdout` + +```text +`panic any +``` + +## ``type` + +## ``sync_type` + +## ``async_type` + +## ``copy` diff --git a/docs/language/ownership.md b/docs/language/ownership.md new file mode 100644 index 0000000..289846c --- /dev/null +++ b/docs/language/ownership.md @@ -0,0 +1,13 @@ +# Ownership + +--- + +# Copying + +# Moving + +## To And From Functions + +# Locking + +## References |
