Lexical Structure
Tokens
Section titled “Tokens”After whitespace and comments are removed (see Source Files), the remaining input is a sequence of tokens. The token kinds are tried in a fixed order and the first that matches at the current position is taken, so an input that could be read as either a number or an identifier is a number.
Numbers
Section titled “Numbers”A number begins with a decimal digit (U+0030–U+0039),
and consists of one or more decimal digits, an optional fractional part introduced by a U+002E (FULL STOP, .),
and an optional suffix that is either a sequence of ASCII letters (a unit)
or a single U+0025 (PERCENT SIGN, %).
Identifiers
Section titled “Identifiers”An identifier is a token that is not a number. Its characters have the Unicode identifier properties defined by Unicode Standard Annex #31:
- The first character shall have the
XID_Startproperty or beU+005F(LOW LINE,_). - Each subsequent character shall have the
XID_Continueproperty or beU+002D(HYPHEN-MINUS,-). - A character with neither property is not part of an identifier.
A decimal digit has the XID_Continue property but not XID_Start,
so it may appear in an identifier but not as its first character;
a token that begins with a digit is a number.
A U+002D (-) shall not appear as the first character of an identifier.
Identifier Normalization
Section titled “Identifier Normalization”Two identifiers are considered the same if and only if their normalized forms are equal. The normalized form of an identifier is obtained by applying the following replacements over the characters of the source identifier:
- Each
U+005F(_) is replaced withU+002D(-), except as the first character. - All other characters are left unchanged.
For example, foo_bar and foo-bar are the same identifier, and so are _foo_bar and _foo-bar.
The kebab-case form (with U+002D) is the canonical written form.
Contextual Keywords
Section titled “Contextual Keywords”Slint has no globally reserved words. Each language construct is introduced by a contextual keyword: an identifier that has a special meaning only when it appears in a position where the grammar expects that construct.
© 2026 SixtyFPS GmbH