Theory → Formal Languages
Context-Free Language
A formal language generated by a context-free grammar and recognized by a pushdown automaton.
Motivation
Context-free language solves the problem of describing nested structures such as balanced parentheses and many programming language syntaxes.
Where it fits
Context-Free Language belongs to formal language theory and parsing.
Mental model
A context-free grammar can express recursive structure better than a regular language.
Common mistakes
- Assuming every programming language is purely context-free.
- Confusing syntax parsing with type checking or semantics.
Related concepts
Context-Free Language connects to grammar, parser, pushdown automaton, and compiler.