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:
Regex | Description |
---|---|
^__[a-zA-Z0-9:]*$ | Compiler internals |
^_Q[a-zA-Z0-9:]*$ | Reserved for maintainers |
Reserved Words
Word | Description |
---|---|
abstract | Reserved for future use |
base | Reserved for future use |
delegate | Reserved for future use |
explicit | Reserved for future use |
finally | Reserved for future use |
fixed | Reserved for future use |
goto | Reserved for future use |
impl | Reserved for future use |
implicit | Reserved for future use |
interface | Reserved for future use |
internal | Reserved for future use |
lock | Reserved for future use |
loop | Reserved for future use |
match | Reserved for future use |
mod | Reserved for future use |
move | Reserved for future use |
mut | Reserved for future use |
new | Reserved for future use |
operator | Reserved for future use |
override | Reserved for future use |
readonly | Reserved for future use |
ref | Reserved for future use |
sealed | Reserved for future use |
stackalloc | Reserved for future use |
super | Reserved for future use |
this | Reserved for future use |
trait | Reserved for future use |
unchecked | Reserved for future use |
use | Reserved for future use |
virtual | Reserved for future use |
where | Reserved 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. */