Articles (Context-Dependent)#
| Keyword | Usage |
|---|---|
a, an | Declares new variable with type |
the | References existing variable |
Statement Starters#
| Keyword | Purpose |
|---|---|
Print | Output |
Set, Create | Variable declaration |
If, When | Conditional |
While | Loop |
For | Iteration |
To | Function definition |
Return | Return value |
Increment | Add 1 to variable |
Decrement | Subtract 1 from variable |
Break | Exit loop |
Continue | Skip to next iteration |
Exit | Terminate program with exit code |
Append | Add element to list |
Create, Change, Remove/Delete | Directories, device nodes, symlinks, chdir (see Directories, Mounting, and Process Control) |
Mount, Unmount/Umount | Mount/unmount filesystems |
Pivot | pivot_root - switch the root filesystem |
Execute | execve - replace the process image |
Shutdown/Poweroff, Reboot/Restart, Halt | reboot(2) - power off/restart/halt the machine |
fork, reap | Process control expressions - fork(2)/wait4(2) |
Send signal | kill(2) - send a signal to a process (child aliases process) |
Flag Schema#
| Keyword | Purpose |
|---|---|
Flag | Declare a command-line flag schema (a flag called ...) |
Parse | Trigger command-line flag parsing (Parse flags.) |
Required | Mark a flag as required |
Default | Supply a default value for a flag |
Connectors#
| Keyword | Purpose |
|---|---|
with | Function parameters, function arguments |
called, named | Variable naming |
of, to, on | Function arguments |
and | Multiple uses (see below) |
or | Logical OR |
but | Conditional chaining |
then | After condition |
otherwise, else | Alternative branch |
from, to | Range bounds |
The and Keyword#
The word and has multiple context-dependent meanings:
| Context | Example | Meaning |
|---|---|---|
| Logical operator | if x and y then | Boolean AND of two conditions |
| Function parameters | with a number called x and a number called y | Separates parameter declarations |
| Function arguments | 'add' of 3 and 5 | Separates argument values |
| Subject list terminator | x, y, and z are true | Final item in comma-separated list before are |
Disambiguation:
- When
andappears after a comma and beforeare, it's a list terminator - When
andappears between two conditions (no comma), it's a logical operator - When
andfollowswith/of/to/on, it separates arguments
Reserved Aliases#
A few alternate spellings are also reserved because the compiler recognizes them as aliases for canonical keywords:
| Alias | Canonical keyword | Context |
|---|---|---|
ms | milliseconds | Time duration units (Wait 500 ms.) |
message | text | Type name (a message called ... is treated as text) |
string | text | Type name (already listed in the type synonyms) |
These cannot be used as variable names. The diagnostic names the spelling you wrote and notes which canonical keyword it aliases — so a number called ms is ... reports 'ms' as an alternate spelling of 'milliseconds', not the internal canonical name.
Every keyword listed in the tables above is likewise reserved as a variable name. Two that are easy to hit by accident are worth calling out: the flag-schema keyword flag (a flag called ...) and the property keyword empty (x's empty). Writing a number called flag is 1. or a number called empty is 1. is rejected with the same "reserved keyword" diagnostic. (As with any reserved word, you can still quote the name — 'flag', 'empty' — if you genuinely need it.)
Two classes of special word#
Not every word with a special meaning is reserved. Vox distinguishes:
- Reserved keywords — banned as bare names everywhere, because they would be ambiguous anywhere: statement starters, operators (
times,add), type names, connectors. - Contextual keywords — claimed only in the position where they mean something, and ordinary identifiers everywhere else:
start/begin/stop/finishfor timers,sendfor signals,waitinginwithout waiting,availableinis available, the things words, the property wordname, and the property wordcount— claimed after a possessive marker and in thethe argument count/the environment variable countphrases, soa number called count is 0.compiles whilearguments's countkeeps its meaning. The same treatment extends to the whole possessive/phrase family:capacity(also thewith capacity N/of capacity Nbuffer phrase),raw,all(also theall the numbers from/between …range),first,last,second(also theWait 1 second.unit —Set second to 1. Wait second seconds.compiles and waits one second),sizeand its synonymlength(alsowith size NandN bytes in size), andversion(theLibrary <name> version "…"andsee <lib> version "…"headers). Each is a bare variable name everywhere except its one fixed grammatical position;arguments's firstanda number called first is 0.both work in the same program.
The test for which class a word belongs in: if every position where the word means something is grammatically identifiable, it is contextual; only a word that would be ambiguous in ordinary positions is reserved.
Contextual Keywords (Things)#
Three words the things feature claims only inside their construct, and treats as ordinary identifiers everywhere else — the same treatment send/begin/stop get for timers. None of them is a reserved variable name, so a number called thing is 1. and To do. (a function named do) both compile.
| Word | Claimed in | Elsewhere |
|---|---|---|
thing | A thing called <name> has ... (a definition) | ordinary identifier |
has | the verb of a thing definition | ordinary identifier |
do | To do the <type>'s <member> (a member definition) | ordinary identifier |
A fourth, the, gains a second reading in this company: in To do the point's 'placed at' it pairs with a known identifier (the type), where a point's 'placed at' calls a maker that brings a new point into being. See the article rule.