A grammar generates the terminal words reachable from by finitely many productions.
A variable-based grammar has disjoint finite terminal and variable alphabets , a start variable , and productions in which and contains at least one variable.
A nonterminal is unreachable when no word derivable from the start symbol contains it. Productions whose left sides are unreachable do not affect the generated language.
A nonterminal is nonproductive when no word derived from it consists entirely of terminal symbols. Every derivation containing such a symbol therefore fails to produce a word in the generated language.
A right-linear regular grammar has productions of the forms and , where are variables and is a terminal word.
Every sentential form reachable from the start variable of a right-linear grammar is either a terminal word or , where is the unique variable and occurs at the right end.
A variable is accessible when for some terminal word .
A variable is looping when for some terminal word through a nonempty derivation.
A variable is terminable when for some terminal word .
If a finite right-linear grammar generates an infinite language, some variable is accessible, looping, and terminable. It is the repeated variable on a sufficiently long accepting derivation.
For grammars and with disjoint variable sets, introduce a new variable and set
If both input grammars are variable based, then .
Retain every production of whose right-hand side contains a variable, replace every production with by , include , and use as start variable. If and are right-linear, the resulting grammar is right-linear and generates .
The regular construction relies on a regular derivation having exactly one terminal rule, at its end. In a general variable-based grammar several variables may each use terminal productions, so replacing every such production can introduce several copies of the second start variable.
Even if both input grammars are regular, the added production has two variables on its right-hand side and therefore need not be a regular production.

Articles by others on the same topic (1)

Formal grammar is a set of rules and structures that define the syntax of a language. It provides a formal way to describe how sentences or expressions in a language can be constructed. Formal grammars are widely used in computer science, linguistics, and artificial intelligence to define programming languages, natural languages, and various systems of communication.