I. Definition


A context-free grammar is a notation for describing languages.

It is more powerful than finite automata or RE’s, but still cannot define all possible languages.

Useful for nested structures, e.g., parentheses in programming languages.

<aside> 💡 Basic Idea: use “variables” to stand for sets of strings

1. Formalism

$$ G = (V,T,P,S) $$

Convention

II. Derivations


1. Derivations

We say $\alpha A\beta \Rightarrow \alpha \gamma \beta$, if $A \rightarrow \gamma$ is a production