Which of the followings is a regular grammar?
Which of the followings is a regular grammar? Correct Answer S → abA, A → baB, B → aA, B → bb
The correct answer is option 1.
Concept:
A regular grammar is a grammar that is right-regular or left-regular. Regular grammar is also called Type-3 grammar.
By definition following are equal, Regular lanuage= Type-3 language =Regular expressions =Right linear grammar= Left linear grammar= DFA= NFA=ε-NFA.
Consider V= Non-terminal and T-terminal.
Type-3:
V→VT*, V→T* or V→T*V, V→T*
Type-2:
X→Y here X= only one non-terminal, Y=( V ∪ T)*(any combinations).
Type-1:
X→Y here X,Y=( V ∪ T)*(any combinations) and X<= Y.
Type-0:
X→Y here X,Y=( V ∪ T)*(any combinations).
Option 1:S → abA, A → baB, B → aA, B → bb
True, It is in regular grammar. It follows V→T*V, V→T*.
Option 2: S → abB, A → aaBb, B → bbAa, A → λ
False, It is not regular grammar but is Type-2 grammar or Context-free grammar. And follows X→Y here X= only one non-terminal, Y=( V ∪ T)*(any combinations).
Option 3: S → aSb, S → SS, S → λ
False, It is not regular grammar but is Type-2 grammar or Context-free grammar. And follows X→Y here X= only one non-terminal, Y=( V ∪ T)*(any combinations).
Option 4: S → aSa, S → bSb, S → λ
False, It is not regular grammar but is Type-2 grammar or Context-free grammar. And follows X→Y here X= only one non-terminal, Y=( V ∪ T)*(any combinations).
Hence the correct answer is S → abA, A → baB, B → aA, B → bb.