A context-free grammar G
is a 4-tuple G = (V, Σ, R, S)
where:
V
is a finite set; each elementv ∈ V
is called a variable. Each variable represents a different type of phrase or clause in the sentence.Σ
is a finite set of terminals, disjoint fromV
, which make up the actual content of the sentence. The set of terminals is the alphabet of the language defined by the grammarG
.R
is a finite relation in(V × (V ∪ Σ)*)
. The members ofR
are called productions of the grammar (symbolized byP
).S
is the start variable, used to represent the whole sentence. It must be an element ofV
.