How to convert FA to Left Linear Grammar in TOC?

A grammar with at most one variable at the right side of production is called linear grammar.

Following is an example of the linear grammar −


Here, if you observe, we can write the same production by dividing …..




Left Linear Grammar

A grammar is left linear grammar where all non-terminals in the right hand sides are at the left end.

For example,


Steps for conversion

The steps for the conversion of finite automata (FA) to the left linear grammar are as follows −

Step 1 − Take reverse of the finite automata

Step 2 − write right linear grammar

Step 3 − Then take reverse of the right linear grammar

Step 4 − And finally, you will get left linear grammar

Consider a Finite Automata as given below −

Make final state as initial state and initial state as final state, as shown below −

Now remove the unreachable states, as shown below −

After removing the unreachable states, the transition diagram is not in the deterministic finite automata (DFA) because state A has no output symbol whereas state B is having two outputs on symbol ‘a’

So the resultant diagram looks like the Non-deterministic finite automata (NFA).

First, generate the right linear grammar for the final transition diagram −



Now reverse the right linear grammar to generate left linear grammar −

      B → Ba/Bb/Aa


Updated on: 12-Jun-2021

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started