- 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 Chomsky normal form in TOC
Chomsky’s Normal Form Stands as CNF.
A context free grammar is in CNF, if the production rules satisfy one of the following conditions
- If there is start Symbol generating ε. Example − A-> ε
- If a non-terminal generates two non-terminals. Example − S->AB
- If a non-terminal generates a terminal. Example − S->a
Example
Let's take G1 Production rules, as given below −
G1={ S->AB, S->c, A->a, B->b}
G1 satisfies the rule specified for CNF. So, it is in CNF.
Now, let's consider G2 production rules, as shown below
G2={ S->aA, A->a, B->c}
G2 does not satisfy the rules specified for CNF, as S->aA contains a terminal followed by a non-terminal.
So, G2 is not in CNF
Consider another example to check whether the given grammar is in CNF or not.
The grammar is as follows −
S->a|aA|B A->aBB| ε B->Aa|b
The given grammar is not in CNF because, S->aA ,A->aBB, B->Aa contains terminals followed by non-terminals.
Advertisements