Keywords - The Nitrate Programming Language
Nitrate keywords are predefined, reserved identifiers that have special meanings to the compiler. They can't be used as identifiers in your program. The following table lists the keywords in the Nitrate programming language. The usage and semantics of keywords is outside the scope of the lexical structure specification.
Keywords
Keyword | Description |
---|---|
subsystem | Defines a namespace with optionally annotated dependencies |
import | Import an external symbol |
pub | Designates public visibility |
sec | Designates private visibility |
pro | Designates protected visibility |
type | Type alias (meaning is context-dependent) |
let | Declare a stack-allocated variable |
var | Declare a heap-allocated variable |
const | Read-only variable (meaning is context-dependent) |
static | Meaning is context-dependent |
struct | Define an ordered composition of fields and methods |
region | Define a packed composition of fields and methods |
group | Define an unordered composition of fields and methods |
class | Define an unordered composition of fields and methods |
union | Define a superposition of other types |
opaque | Opauqe type |
enum | Define a set of named constants |
fstring | Mark a string as a format string |
with | Assign named attributes |
fn | Function (meaning is context-dependent) |
noexcept | No exceptions are thrown |
foreign | Imported symbol is implemented in a different language |
impure | Function is not pure |
tsafe | Function is thread-safe |
pure | Function is pure |
quasipure | Function is pure if and only if its returned value is not used |
retropure | Function is pure if and only if its the only item preventing it arguments from being unused |
crashpoint | Code is a crash point |
inline | Request for inlining |
unsafe | Here be dragons |
safe | Safe code |
volatile | I don't know what I'm doing with this |
promise | Function contract specification |
if | Control flow |
else | Control flow |
for | Control flow |
while | Control flow |
do | Control flow |
switch | Control flow |
case | Control flow |
default | Control flow |
break | Control flow |
continue | Control flow |
ret | Return statement |
retif | Syntax sugar for: if (cond) { ret val; } |
retz | Syntax sugar for: if (!cond) { ret val; } |
retv | Syntax sugar for: if (cond) { ret; } |
form | Concurrent iteration |
foreach | For-each loop |
try | Exception handling |
catch | Catch exception |
throw | Raise exception |
__asm__ | Inline assembly |
void | Absence of thing |
undef | Uninitialized value |
null | Satan's pet lizzard |
true | Boolean true |
false | Boolean false |
Formal Definition
<keyword> ::= "subsystem" | "import" | "pub" | "sec" | "pro" | "type" | "let" |
"var" | "const" | "static" | "struct" | "region" | "group" |
"class" | "union" | "opaque" | "enum" | "fstring" | "with" |
"fn" | "noexcept" | "foreign" | "impure" | "tsafe" | "pure" |
"quasipure" | "retropure" | "crashpoint" | "inline" | "unsafe" |
"safe" | "volatile" | "promise" | "if" | "else" | "for" |
"while" | "do" | "switch" | "case" | "default" | "break" |
"continue" | "ret" | "retif" | "retz" | "retv" | "form" |
"foreach" | "try" | "catch" | "throw" | "__asm__" | "void" |
"undef" | "null" | "true" | "false"