Alphabet (formal languages)
Part of Formal languages |
In
It is often necessary for practical purposes to restrict the symbols in an alphabet so that they are unambiguous when interpreted. For instance, if the two-member alphabet is {00,0}, a string written on paper as "000" is ambiguous because it is unclear if it is a sequence of three "0" symbols, a "00" followed by a "0", or a "0" followed by a "00".
Notation
If L is a formal language, i.e. a (possibly infinite) set of finite-length strings, the alphabet of L is the set of all symbols that may occur in any string in L. For example, if L is the set of all variable identifiers in the programming language C, L's alphabet is the set { a, b, c, ..., x, y, z, A, B, C, ..., X, Y, Z, 0, 1, 2, ..., 7, 8, 9, _ }.
Given an alphabet , the set of all strings of length over the alphabet is indicated by . The set of all finite strings (regardless of their length) is indicated by the Kleene star operator as , and is also called the Kleene closure of . The notation indicates the set of all infinite sequences over the alphabet , and indicates the set of all finite or infinite sequences.
For example, using the binary alphabet {0,1}, the strings ε, 0, 1, 00, 01, 10, 11, 000, etc. are all in the Kleene closure of the alphabet (where ε represents the empty string).
Applications
Alphabets are important in the use of
When using automata,
See also
References
- ISBN 0-53492-373-9.
An alphabet is a nonempty finite set the members of which are called symbols or characters.
- ISBN 0-387-94258-0.
By an alphabet we mean a nonempty set of symbols.
- ISBN 978-0-07-338309-5.
A vocabulary (or alphabet) V is a finite, nonempty set of elements called symbols. A word (or sentence) over V is a string of finite length of elements of V.
- ISBN 978-1-4419-1220-6.
If 𝗔 is an alphabet, i.e., if the elements 𝐬 ∈ 𝗔 are symbols or at least named symbols, then the sequence (𝐬1,...,𝐬n)∈𝗔n is written as 𝐬1···𝐬n and called a string or a word over 𝗔.
Literature
- John E. Hopcroft and Jeffrey D. Ullman, ISBN 0-201-02988-X.