aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2025-08-04 22:00:45 +0000
committers-ol <s+removethis@s-ol.nu>2025-08-04 22:00:53 +0000
commit930dea7dcf9aa8fa4fe0dc5d1a0ff8adf526aefe (patch)
tree57a71acabb3a5eb450cbed0a18841552f5afddc5 /docs
parentlib/osc: send without arguments, triggers on path (diff)
downloadalive-930dea7dcf9aa8fa4fe0dc5d1a0ff8adf526aefe.tar.gz
alive-930dea7dcf9aa8fa4fe0dc5d1a0ff8adf526aefe.zip
docs/reference: update comments, literals sections
Diffstat (limited to 'docs')
-rw-r--r--docs/reference/01_syntax.md23
1 files changed, 19 insertions, 4 deletions
diff --git a/docs/reference/01_syntax.md b/docs/reference/01_syntax.md
index 4db70f9..30827f3 100644
--- a/docs/reference/01_syntax.md
+++ b/docs/reference/01_syntax.md
@@ -2,7 +2,7 @@
whitespace. Each expression may be either a literal constant or a cell.
# literal constants
-There are three types of literals with different syntax:
+There are three types of simple literals with different syntax:
## numbers
Numbers consist of the digits `0`-`9` and can optionally begin with a
@@ -78,7 +78,7 @@ behaviour of the cell.
Tags consist of one or more digits (`0`-`9`) enclosed in square brackets (`[`
and `]`). `[1]` and `[255]` are examples of valid tags.
-## template strings
+# template strings
Template Strings are a different syntax for cells that allows embedding alv
expressions inside of a string literal. They can be used to perform string
substitution, especially within code of other languages.
@@ -106,6 +106,17 @@ semantically identical to the previous examples respectively:
([99]fmt ["five is" ""] (+ 3 2))
(fmt ["there is $no substitution here"])
+# arrays and structs
+Array and struct literals too are syntatic shortcuts for the [mkarray][] and
+[mkstruct][] builtins respectively.
+
+Arrays are a list of expressions separated by whitespace enclosed in square
+brackets (`[` and `]`). Similarly structs are a list of key-value pairs
+separated by whitespace and enclosed in curly brackets (`{` and `}`).
+
+Arrays and structs must contain at least one element or key-value pair
+respectively.
+
# whitespace
The space, tab, newline, and line-feed special characters constitute whitespace
and may be repeated any number of times to form a chunk. A chunk of whitespace
@@ -113,5 +124,9 @@ may also contain any number of comments, but may neither begin nor end with a
comment.
## comments
-A comment begins with `#(` and ends with a matching parenthesis `)`. Comments
-may contain other comments or cells.
+A comment cell begins with `#(` and ends with a matching parenthesis `)`.
+Comment cells may contain other comments or cells.
+
+Line comments begin with `##` and end at the end of the line. Line comments
+have precedence over comment cells, i.e. comment cells within line comments do
+not continue past the end of the line.