- 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
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
- Related Articles
- Explain Type-0 grammar in TOC
- Explain Type-1 grammar in TOC
- Explain type 2 grammar with properties
- What is type 3 grammar? Explain its properties
- Explain Operator grammar and precedence parser in TOC
- Explain the concept of grammar in TOC
- Explain the relationship between grammar and language in TOC
- Explain about left linear regular grammar in TOC
- Explain the simplification of context free grammar in TOC
- What is unambiguous grammar in TOC?
- Explain nutrition and its type.
- What do you mean by grammar and production in TOC?
- Difference Between Type 1 and Type 2 Diabetes
- What do you mean by ambiguity in grammar in TOC?
- Explain the symbol type in TypeScript

Advertisements