Appendix: Token Reference

The following table lists every token kind recognized by the Rux lexer.

Literals

TokenExample
IntLiteral42, 0xFF, 0b1010, 0o77
FloatLiteral3.14, 1.0e-9
StringLiteral"hello"
CharLiteral'A', '\n'
BoolLiteraltrue, false

Identifiers

TokenDescription
IdentifierAny non-keyword name

Keywords

TokenSpelling
IfKeywordif
ElseKeywordelse
WhileKeywordwhile
LoopKeywordloop
ForKeywordfor
InKeywordin
BreakKeywordbreak
ContinueKeywordcontinue
ReturnKeywordreturn
MatchKeywordmatch
FuncKeywordfunc
AsmKeywordasm
VarKeywordvar
LetKeywordlet
ConstKeywordconst
TypeKeywordtype
StructKeywordstruct
EnumKeywordenum
UnionKeywordunion
InterfaceKeywordinterface
ExtendKeywordextend
ModuleKeywordmodule
ImportKeywordimport
PubKeywordpub
ExternKeywordextern
AsKeywordas
IsKeywordis
NullKeywordnull
SelfKeywordself

Punctuation

TokenSymbol
LeftParen(
RightParen)
LeftBrace{
RightBrace}
LeftBracket[
RightBracket]
Comma,
Semicolon;
Colon:
ColonColon::
Dot.
DotDot..
DotDotDot...
Arrow->
FatArrow=>
At@
Hash#
Question?
Tilde~

Operators

TokenSymbol
Plus+
Minus-
Star*
Slash/
Percent%
StarStar**
Amp&
Pipe|
Caret^
LessLess<<
GreaterGreater>>
GreaterGreaterGreater>>>
AmpAmp&&
PipePipe||
Bang!
Equal==
BangEqual!=
Less<
LessEqual<=
Greater>
GreaterEqual>=
Assign=
PlusAssign+=
MinusAssign-=
StarAssign*=
SlashAssign/=
PercentAssign%=
AmpAssign&=
PipeAssign|=
CaretAssign^=
LessLessAssign<<=
GreaterGreaterAssign>>=
GreaterGreaterGreaterAssign>>>=

Special

TokenDescription
NewLineSignificant newline (grammar-dependent)
EndOfFileMarks the end of the source file
UnknownUnrecognized character; preserved for error recovery