- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 −
S→aSb/ε
Here, if you observe, we can write the same production by dividing …..
S→Ab
A→aAb
A→ε
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,
A→Sa/ε
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 −
B→aA/aB/bB
A→ε
Now reverse the right linear grammar to generate left linear grammar −
B → Ba/Bb/Aa
A→ε
- Related Articles
- How to convert FA to Right Linear Regular Grammar?
- How to convert right linear grammar to left linear grammar?
- How to convert left linear grammar to right linear grammar?
- Explain about left linear regular grammar in TOC
- What is unambiguous grammar in TOC?
- Explain Type-0 grammar in TOC
- Explain Type-1 grammar in TOC
- Explain the concept of grammar in TOC
- How to convert from NFA to DFA in TOC?
- How to convert NFA with epsilon to DFA in TOC?
- Explain Operator grammar and precedence parser in TOC
- How to convert context free grammar to push down automata?
- Explain the relationship between grammar and language in TOC
- Explain the simplification of context free grammar in TOC
- Explain Type-2 and Type-3 Grammar in TOC?
