Lably
Skip to content

Regular grammar

Type of formal grammar

  • 4 min read
  • 5 chapters

Related on Lably

Through Converse (logic)

Every regular grammar describes a regular language.

Strictly regular grammars

A right-regular grammar (also called right-linear grammar) is a formal grammar (N, Σ, P, S) in which all production rules in P are of one of the following forms:

  1. A → a
  2. A → aB
  3. A → ε

where A, B, S ∈ N are non-terminal symbols, a ∈ Σ is a terminal symbol, and ε denotes the empty string, i.e. the string of length 0. S is called the start symbol.

In a left-regular grammar, (also called left-linear grammar), all rules obey the forms

  1. A → a
  2. A → Ba
  3. A → ε

The language described by a given grammar is the set of all strings that contain only terminal symbols and can be derived from the start symbol by repeated application of production rules. Two grammars are called weakly equivalent if they describe the same language.

Rules of both kinds must not be mixed; for example, the grammar with rule set { S→aT, T→Sb, S→ε } is not regular, and describes the language {aibi:i∈N}, which is not regular, either.

Some textbooks and articles disallow empty production rules, and assume that the empty string is not present in languages.

Sign in to keep reading

4 more chapters are free with a Lably account.

More in Topics in mathematics