A formal language defines valid statements through strict rules for composing and interpreting symbols. Like a lock that accepts one correct sequence, it lets a machine recognize a command and produce a specific response. Mathematics, programming expressions, regular expressions, and some natural-language patterns can all use formal-language rules. section 1.4.1
Recognizing a chatbot greeting
A chatbot can match the phrase “Hello, Rosa” with a regular expression, trigger a scripted greeting, and extract useful information from the user’s statement. The same pattern-matching approach can recognize commands that unlock actions. section 1.4.1 section 1.4.2
Formal languages support several related operations:
- Define acceptable sequences with grammars, including regular grammars. section 1.4.1 section 1.4.2
- Match character sequences in search tools or user statements. section 1.4.2
- Represent processing as a finite-state machine or deterministic finite automaton. section 1.4.2
Figure 1.4 Kinds of automata
Compare how formal languages used to program finite-state automata are nested within kinds of automata. section 1.4.2

