A type of
token extracted during the
lexical analysis phase of compiling a
computer program. Most
programming languages
1 define an identifier as a
letter2 followed by any number of letters or digits. However, most languages
3 reserve certain of these character sequences as
keywords, not allowing programmers to make identifiers from them.
Programmers create identifiers to name things in their programs:
1There is at least one language that confuses identifiers and string literals, and infers which is which only from context.
2The definition of a "letter" varies between computer languages. Some allow only
upper case letters, but most allow
lower case letters and/or
underscores.
3Again, some languages recognize keywords only where they are meaningful as keywords, and allow them to be used as identifers! There is the opposite example of
C++ which reserves any sequence beginning with an underscore followed by a capital letter or another underscore for compiler and library implementors.