Skip to content

Keywords ​

Keywords are reserved tokens in the Tyrus grammar that have special syntactic meanings. They cannot be used as identifier names for variables, constants, functions, interfaces, types, parameters, or other bindings.

Active Keywords ​

Active keywords are recognized and parsed by the Tyrus compiler and lexer. They are organized into five primary functional categories.

Declarations and Modifiers ​

These keywords introduce declarations, scope visibility, immutability, and compile-time evaluations.

KeywordDescription
asyncDeclares asynchronous functions returning promises
comptimeEvaluates expressions or blocks at compile time
constDeclares deeply immutable bindings
enumDefines an enumerated type with fixed variants
exportPublishes a symbol across all files in the project
fromSpecifies the module specifier in import statements
functionDeclares a named or anonymous function
importLoads declarations from local files or native modules
interfaceDefines a structural object shape or contract
letDeclares a mutable binding
protectRestricts export reach to the declaring folder and subfolders
readonlyEnforces deep immutability on properties and types
typeDeclares a type alias
validatorDeclares custom validation logic for decorator validation

Control Flow and Error Handling ​

These keywords control branches, loops, function returns, deferred cleanups, and exception handling.

KeywordDescription
breakTerminates execution of the nearest loop or switch
caseDefines a branch arm within a switch statement
catchCaptures errors thrown inside a try block
continueAdvances execution to the next loop iteration
defaultFallback branch in a switch statement
deferExecutes cleanup logic unconditionally upon exiting scope
doInitiates a do-while loop block
elseAlternative branch in conditional statements
errdeferExecutes cleanup logic only when exiting scope with an error
finallyExecutes cleanup logic regardless of success or exception
forLoops over collections, ranges, or numeric steps
ifConditional execution branch
loopUnconditional infinite loop block
matchPattern matching expression with destructuring
onfailAttaches a recovery handler on block failure
returnReturns a value and terminates the current function
switchDispatches control based on literal values or enum tags
throwThrows an error or exception
throwsDeclares typed recoverable error contracts on functions
tryExecutes a block with exception capture support
whileLoops while a condition evaluates to true

Expressions and Operators ​

These keywords act as operators, type casts, or clauses within expressions.

KeywordDescription
andLogical conjunction operator
asType assertion or import alias clause
atPositional indexing or decorator target clause
awaitPauses execution awaiting asynchronous completion
extendsType parameter constraint clause
inMembership check in loops and expressions
isType checking operator
notLogical negation operator
ofValue iteration clause in for-of loops
orLogical disjunction operator
typeofInspects type metadata at compile time or runtime

Primitive Types ​

These keywords represent the built-in primitive scalar and numeric types of the language.

KeywordDescription
booleanLogical true or false value
char32-bit Unicode scalar character
decimalExact fixed-precision decimal arithmetic type
f128128-bit IEEE 754 floating-point number
f3232-bit single-precision floating-point number
f6464-bit double-precision floating-point number
i128128-bit signed integer
i1616-bit signed integer
i3232-bit signed integer
i6464-bit signed integer
i88-bit signed integer
isizeTarget architecture pointer-sized signed integer
neverBottom type representing unreachable code or values
stringImmutable UTF-8 encoded string
u128128-bit unsigned integer
u1616-bit unsigned integer
u3232-bit unsigned integer
u6464-bit unsigned integer
u88-bit unsigned integer
unknownTop type requiring narrowing before member access
usizeTarget architecture pointer-sized unsigned integer
voidReturn type of functions yielding no value

Literal Values ​

These keywords denote primitive literals and absence constants.

KeywordDescription
falseBoolean false literal
InfinityFloating-point positive infinity literal
NaNFloating-point not-a-number literal
NoneOptional absence pattern sentinel
nullReserved absence literal (prohibited as a runtime value)
trueBoolean true literal

Reserved for Future Use ​

These keywords are reserved for future language syntax and cannot be used as user-defined identifiers.

CategoryKeywordsDescription
Classes and OOPclass, constructor, implements, instanceof, new, override, super, thisReserved for potential object-oriented and class constructs
Visibility and Modifiersabstract, private, protected, public, staticReserved for member visibility and scope qualifiers
Modules and Scopesdeclare, module, namespace, package, require, varReserved for ambient declarations and module system extensions
Type Systemasserts, infer, intrinsic, keyof, satisfies, uniqueReserved for advanced type operators and narrowing
Accessors and Parametersget, out, setReserved for property accessors and parameter passing modes
Execution and Controldebugger, delete, when, with, yieldReserved for debugging, generator execution, and pattern conditions

Ambient Built-ins ​

These built-in identifiers are ambiently provided in the global scope without requiring an import statement.

IdentifierDescription
assertRuntime assertion verifying a boolean condition
assertEqualRuntime equality verification between two values
assertThrowsRuntime verification that a closure throws an expected error
consoleStandard console logging namespace
isNaNChecks whether a numeric value is NaN
MapBuilt-in associative key-value map collection
panicAborts execution immediately with an error message
printStandard output printing function
printCRCarriage return output helper for terminal progress
printErrorStandard error stream printing function
printRawRaw unformatted printing function
printWarnStandard error warning printing function
SetBuilt-in unique value set collection