- 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
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.
|alpha| =1
There is no restriction on beta.
The production rules are in the form of −
A->alpha
Where, A is any single non-terminal and is any combination of terminals and nonterminals.
Example
S->AB
A->a
B->b
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*
Example
S->ab
Advertisements