A **context-free grammar** (= CFG = phrase structure grammar) is a formal
grammar.

Isomorphic to a pushdown automaton.

A context-free grammar consists of:

- A finite set of terminal symbols, sometimes referred to as "tokens".
- A finite set of nonterminals, sometimes called "syntactic variables".
- A finite set of productions
- A designation of one of the nonterminals as the start symbol.

A *production* consists of:

- A nonterminal, called the head or left side of the production
- An arrow
- A sequence of terminals or nonterminals, called the body or right side of the production.

A production rule which generates ungrammatical sentences *overgenerates*.

Nonterminals must be a phrasal category.

Context-free grammars have rules of the type:

A -> B

but no rules of the type:

x A y -> x B C y

where what happens with A depends on its context.

The adequacy of context-free grammars for representing the syntax of natural languages has been addressed by many people in different way.

It is unclear if English cannot be represented by context-free grammar, but it can be shown to be inadequate due to is being very complex. [1]

In computer science, a popular notation for context-free grammars is Backus-Naur Form.

In linguistics:

- Parenthesis indicate an optional item. For example,
`S -> NP (T) VP`. - Curly brackets
`{}`indicate a choice. For example,`S -> {NP/S'} T VP`.

- Shieber 1985, Evidence against the context-freeness of natural language
- Beherenfeldt 2009