See all glossary terms

Token

A token is a single unit of text that the language uses to express something. Tokens can be words, numbers, punctuation, or even other tokens.
In GDScript, if is a token, as is func, class, var, but also values like 13.8 or true.
Anything separated by a space or a set of parenthesis, or a comma, is a token.
For example, in the expressions below:
if health < 10:
  health = health + 5;
Here are the tokens used:
  • if (keyword)
  • health (identifier)
  • < (operator)
  • 10 (literal number)
  • health (identifier)
  • = (operator)
  • health (identifier)
  • + (operator)
  • 5 (literal number)
To compile a language, a compiler will first identify the tokens and label them, so it can process them.

See Also

Related terms in the Glossary