A Context Free Grammar (CFG) consists of four components:
- An alphabet of terminal symbols, which we shall usually write as $\Sigma$ (capital letter sigma)
- A finite, non-empty set of non-terminal symbols, disjoint from the terminals, which we shall usually write as $\mathcal{N}$ (caligraphic letter N)
- A finite set of production rules, which we shall usually write as $\mathcal{R}$ (caligraphic letter R)
- A designated non-terminal from $\mathcal{N}$, called the start symbol, which we will usually write as $S$.
A sentential form is just a sequence of terminals (from $\Sigma$) and nonterminals (from $\mathcal{N}$).
The production rules $\mathcal{R}$ of a CFG consisting of components \((\Sigma,\mathcal{N},\mathcal{R},S)\) each have shape:
\[X \longrightarrow \alpha\]where $X$ is a nonterminal from $\mathcal{N}$ and $\alpha$ is a sentenial form over $\Sigma$ and $\mathcal{N}$.