diff options
Diffstat (limited to 'docs/language/index.md')
| -rw-r--r-- | docs/language/index.md | 225 |
1 files changed, 0 insertions, 225 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 } -``` |
