From d0698df5d7ded7c65478c923caf11bfa2c5efa68 Mon Sep 17 00:00:00 2001 From: nodist Date: Mon, 4 May 2026 10:37:29 -0400 Subject: names and literals --- docs/syntax/index.md | 57 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 8 deletions(-) (limited to 'docs') diff --git a/docs/syntax/index.md b/docs/syntax/index.md index 4343a2f..27160b2 100644 --- a/docs/syntax/index.md +++ b/docs/syntax/index.md @@ -2,7 +2,7 @@ --- -##### Code is encoded as UTF-8, allowed glyphs are: +Code is encoded as UTF-8, allowed glyphs are: ```text abcdefghijklmnopqrstuvwxyz @@ -12,26 +12,67 @@ ABCDEFGHIJKLMNOPQRSTUVWXYZ \s\t\n ``` -##### Any UTF-8 glyph is allowed between `""` +## Comments ```text -Ω - Invalid code -"Ω" - Valid code +// This is a comment until the end of the line + +/* Comment block */ ``` -## Comments +## Number Literals + +##### Integer +```text +12 // Decimal +0x12 // Hex +0b10 // Binary +0o75 // Octal ``` -// This is a comment until the end of the line -/* Comment block */ +##### Float + +```text +1.2 +1e6 ``` +Underscores `_` can separate digits in a number + +```test +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 + ## Operators Represented as an symbol or a keyword starting with \` -``` +```text 1 + 2 1 `add 2 ``` -- cgit v1.2.3