Context-Free Grammars
Context-Free Languages (CFLs) are more powerful than Regular Languages (provably so) and can be defined by means of Context-Free Grammars or Push-Down Automata. Any context free language can be represented with either of these methods. CFLs closely relate to both human languages and programming languages and their applications tend to fall within these fields.
A Context-Free Grammar (CFG) is essentially a collection of substitution rules of the form where
is a variable (or nonterminal symbol) and
is a string of terminal and nonterminal symbols.
The formal definition of a Context-Free Grammar is a four tuple where:
is a finite set of non-terminals
is a finite set of terminals such that
is a finite set of production rules which take the form
where
is the start variable and
For example, we can denote if
and so on.
Grammars can be established to model a range of applications from mathematical equations to human language constructs.
Chomsky Normal Form
Chomsky Normal Form is a theorum that every CFG can be written in the form:
Where
Many proofs in the field of context-free languages make use of this form since due to its expanisve nature the derivation of a string on length always predictably involves
steps, and a parse tree generated from a Chomsky Normal Form grammar will always be a binary tree of height at most
.