# Explain about left linear regular grammar in TOC

Data Structure AlgorithmsComputer ScienceComputers

Regular grammar describes a regular language. It consists of four components, which are as follows −

G = (N, E, P, S)

Where,

• N − finite set of non-terminal symbols,

• E − a finite set of terminal symbols,

• P − a set of production rules, each of one is in the forms

• S → aB

• S → a

• S → ∈,

• S ∈ N is the start symbol.

The above grammar can be of two forms −

• Right Linear Regular Grammar

• Left Linear Regular Grammar

## Linear Grammar

When the right side of the Grammar part has only one terminal then it's linear else nonv linear.

## Left linear grammar

In a left-regular grammar (also called left-linear grammar), the rules are of the form as given below −

• L → a, {L is a non-terminal in N and a is a terminal in Σ}

• L → Ma, {L and M are in N and a is in Σ}

• L → ∈, {∈ is the empty string}.

The left linear grammar means that the non-terminal symbol will be at the left side.

### Example

Consider a language {bnabma| n>=2, m>=2}

The left linear grammar that is generated based on given language is −

S → Bbba       ⇒ last 3 symbols bba
B → Bb| Dbba   ⇒ for bm and bba are for bn followed by a.
D → Db|e       ⇒ for bn-2