Explain Type-2 and Type-3 Grammar in TOC?
The Chomsky hierarchy is given below −
Type 2 − Context Free Grammar (CFG)
- Type 2 grammars are generated by context free languages.
- The language that is generated by the grammar is recognized by Push Down Automata.
- Type 2 must be in Type 1.
- Left-hand side of production can have only one variable.
There is no restriction on beta.
The production rules are in the form of −
Where, A is any single non-terminal and is any combination of terminals and nonterminals.
Type 3 − Regular grammar
- Type 3 grammars are generated by regular languages.
- These languages are exactly all those languages that can be accepted by finite state automata.
- Type 3 is the most restricted grammar.
It is in the form of
V->VT*/T* Or V->T*V/T*
Published on 16-Jun-2021 12:50:21