Foundations: Alphabets, Strings & Languages

a symbol

A symbol is one indivisible mark from your alphabet, like a single letter tile or a single key on a keyboard. It is the smallest thing you can write down. Just as a single brick is the smallest piece of a brick wall, a symbol is the smallest piece of a string. You never look inside a symbol; it simply is what it is.

Formally, a symbol (also called a letter) is a member of an alphabet Σ. If Σ = {a, b}, then a is a symbol and b is a symbol, and those are the only two symbols available. The theory treats symbols as abstract atoms: it does not matter whether a is printed in a serif or sans-serif font, or whether 0 means zero or off or false. All that matters is that distinct symbols are distinguishable from one another and that there are finitely many of them.

The single most common beginner slip is to confuse a symbol with a string of length one. They feel identical, and informally we often blur them, but strictly a is a symbol while the string a is a sequence containing one symbol. This distinction becomes important once we start applying string operations like concatenation, which act on strings, not on bare symbols.

In Σ = {0, 1}, the symbols are 0 and 1. The two-character 01 is not a symbol; it is a string made of two symbols.

A symbol is one element of the alphabet; concatenating symbols makes strings.

Symbols are atomic: the theory never peeks inside them. A symbol of length one and a string of length one are conceptually different, even though we often use them interchangeably in casual writing.

Also called
lettercharacter字符字母