Identifiers

An identifier is a name chosen by the programer. This name can be attributed to many things like variables, functions, classes, etc...

  • An identifier MUST be a string of at least 1 character.
  • An identifier MUST NOT contains any blank character, control character, or symbol (see below for the definition of the last ones).
  • An identifier MUST NOT starts with a digit.
  • An identifier MUST NOT be a reserved keyword.
; characters defined as whitespace in Unicode standard and 6 others (U+180E, U+200B, U+200C, U+200D, U+2060 and U+FEFF)
blank-character = %u0009-000D / %u0020 / %u0085 / %u00A0 / %u1680 / %u180E / %u2000-200D / %u2028-2029 / %u2060 / %u202F / %u205F / %u3000 / %uFEFF

; C0 controls, C1 controls, and U+007F
control-character = %u0000-001F / %u007F-009F

; ASCII digits
decimal-digit = %u0030-0039

; ASCII punctuation and symbols, except U+0020
symbol = %u0021-002F / %u0039-0040 / %u005B-0060 / %u007B-007E

; non blank, non control, non digit, non symbol
neutral-character = %u0041-0059 / %u0061-007A / %u00A1-167F / %u1681-180D / %u180F-1FFF / %u200E-2027 / %u202A-202E / %u2030-205E / %u2061-2FFF / %u3001-FEFE / %uFF00-10FFFF

unchecked-identifier = neutral-character *(neutral-character / decimal-digit)
identifier = ; unchecked-identifier which is not a reserved keyword

Reserved keywords:

  • bool
  • char
  • f32
  • f64
  • false
  • i16
  • i32
  • i64
  • i8
  • NaN
  • NegInfinity
  • PosInfinity
  • true
  • u16
  • u32
  • u64
  • u8

Last update: March 29, 2021