Formal Languages & Grammars
Alphabets, Strings, and Languages
Formal language theory begins with three foundational objects: alphabets, strings, and languages. These objects let us describe computation with precision rather than intuition.
An alphabet is a finite, non-empty set of symbols. We usually denote alphabets with capital Greek letters such as Sigma.
A string over an alphabet Sigma is a finite sequence of symbols from Sigma. The empty string is denoted by epsilon and has length zero.
A language over Sigma is any set of strings over Sigma. In other words, every language is a subset of Sigma star.
Core Notation
The notation below appears constantly in automata, grammars, and computability proofs.
The function |w| returns how many symbols are in w.
Sigma to the power n means all strings of length exactly n over Sigma.
Sigma star is the set of all finite strings over Sigma, including the empty string.
Sigma plus is the set of all non-empty strings over Sigma.
Worked Language Examples
All binary strings of even length.
All strings over a and b that end with ab.
All strings with equal numbers of a and b. This language is not regular, but still a valid language over the alphabet.
A language can be finite, infinite, regular, context-free, decidable, or undecidable. Those classifications come later; for now, language simply means a set of strings.