# Formal language

In mathematics, computer science and linguistics, a formal language is one that has a particular set of symbols, and whose expressions are made according to a particular set of rules. The symbol ${\displaystyle {\mathcal {L}}}$ is often used as a variable for formal languages in logic.[1]

Unlike natural languages, the symbols and formulas in formal languages are syntactically and semantically related to one another in a precise way.[2] As a result, formal languages are completely (or almost completely) void of ambiguity.[3]

## Examples

Some examples of formal languages include:

• The set of all words over ${\displaystyle {a,b}\,}$
• The set ${\displaystyle \left\{a^{n}\right\}}$, where ${\displaystyle n\,}$ is a natural number and ${\displaystyle a^{n}\,}$ means ${\displaystyle a\,}$ repeated ${\displaystyle n}$ times
• Finite languages, such as ${\displaystyle \{\{a,b\},\{a,aa,bba\}\}\,}$
• The set of syntactically correct programs in a given programming language
• The set of inputs upon which a certain Turing machine halts

## Specification

A formal language can be specified in a great variety of ways, such as:

## References

1. "Comprehensive List of Logic Symbols". Math Vault. 2020-04-06. Retrieved 2020-10-09.
2. "Definition of formal language | Dictionary.com". www.dictionary.com. Retrieved 2020-10-09.
3. "1.11. Formal and Natural Languages — How to Think like a Computer Scientist: Interactive Edition". runestone.academy. Retrieved 2020-10-09.

• Helena Rasiowa and Roman Sikorski (1970). The Mathematics of Metamathematics (3rd ed. ed.). PWN. |edition= has extra text (help), chapter 6 Algebra of formalized languages.