Identifiers

An identifier is a single character or a sequence of characters of the following form: upper or lowercase letters from the ISO basic Latin alphabet, underscore, and digits, with the constraint that the first (or singular) character cannot be a digit.

For now, they are used to name qubits and bits (registers) by the user, and predefine the names of useful mathematical constants, built-in functions, and named gates. Note that identifiers are not protected, i.e. they can be reused. For example, it is permissible, however discouraged, to name a (qu)bit (register) pi, cos, or Rx.

Reserved keywords cannot be used as an identifier.

Grammar for identifiers

identifier:
letter
identifier letter
identifier digit

letter: one of
a through z or A through Z or _

Examples

q
_i
ID
b01
1q     // first character cannot be a digit
+q     // the underscore '_' is the only permissible special character 
qubit  // 'qubit' is a reserved keyword