Identifiers - The Nitrate Programming Language

Nitrate identifiers are construct aliases for syntactic elements in a program.

Charset

Identifiers can contain the following character ranges:

  • Letters: a-z, A-Z
  • Digits: 0-9. Digits are not allowed as the first character.
  • Underscore: _

These hexadecimal encoded bytes are all the characters that can be used in identifiers:

6162636465666768696a6b6c6d6e6f707172737475767778797a4142434445464748494a4b4c4d4e4f505152535455565758595a303132333435363738395f

Not supported

  • Unfortunately, Nitrate does not currently support other Unicode characters for use in identifiers. This is primarily due to the complexity of Unicode and ABI backwards compatibility with C.

Qualified Identifiers

TODO: Write about qualified identifiers.

Unqualified Identifiers

TODO: Write about unqualified identifiers.

Reserved Prefixes

The following regex patterns are reserved for specific use cases:

RegexDescription
^__[a-zA-Z0-9:]*$Compiler internals
^_Q[a-zA-Z0-9:]*$Reserved for maintainers

Reserved Words

WordDescription
abstractReserved for future use
baseReserved for future use
delegateReserved for future use
explicitReserved for future use
finallyReserved for future use
fixedReserved for future use
gotoReserved for future use
implReserved for future use
implicitReserved for future use
interfaceReserved for future use
internalReserved for future use
lockReserved for future use
loopReserved for future use
matchReserved for future use
modReserved for future use
moveReserved for future use
mutReserved for future use
newReserved for future use
operatorReserved for future use
overrideReserved for future use
readonlyReserved for future use
refReserved for future use
sealedReserved for future use
stackallocReserved for future use
superReserved for future use
thisReserved for future use
traitReserved for future use
uncheckedReserved for future use
useReserved for future use
virtualReserved for future use
whereReserved for future use

Formal Definition

<name_segment_char> ::= ([1-9] | [a-z] | [A-Z] | "_")
<name_segment_prefix> ::= [a-z] | [A-Z] | "_"
<name_segment_body> ::= <name_segment_char> | <name_segment_body> <name_segment_char>
<name_segment> ::= <name_segment_prefix> <name_segment_body>
<identifier> ::= <name_segment> | <identifier> "::" <name_segment>

/* <identifier> must not be a <keyword>. idk how to do that in EBNF. */