Classification of Context Free Grammar – Example DFA design

3737

Classification of Context Free Grammar:

From the behavior of the production rules of the context free grammar, we classify it into two different form are as follows;

  • Right-Linear Grammar
  • Left-Linear Grammar

Right-Linear Grammar:

In right-linear grammar, all productions have one of the two forms:

V → T* V
or V → T*

i.e., the left hand side should have a single variable symbol and the right hand side consists of any number of terminals (members of T) optionally followed by a single variable symbol.

For example:

Right Linear Grammar DFA
A → xB

Right Linear Grammar DFA
Right Linear Grammar DFA State to state transaction
A → xyzB

Right Linear Grammar DFA
Right Linear Grammar DFA to accept string and state
A → B

Right Linear Grammar DFA
Right Linear Grammar DFA to state switch without any input string
A → x

Right Linear Grammar DFA
Right Linear Grammar DFA to reach final state with accepting input string

Left-Linear Grammar:

In a left-linear grammar, all productions have one of the two forms:

V → VT*
or V → T*

i.e., the left hand side must consist of a single variable symbol, and the right-hand side consists of an optional single variable symbol followed by one number of terminals.

Previous articleContext Free Grammar (CFG) Definition, Notation and Examples
Next articleCFG Solved Example – Contex free grammar to context free language tips and tricks
Er Parag Verma
Hello I am Er Parag Verma. I am tech blogger, Professor and Entrepreneur. I am on the mission to change the pattern of learning to make it easy, valuable and advance.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.