- 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
Bhanu Priya has Published 1581 Articles
Bhanu Priya
3K+ Views
CFG stands for context free grammar and CNF stands for Chomsky’s Normal Form in the theory of computation.Context Free Grammar (CFG)A context free grammar (CFG) is a forma grammar which is used to generate all possible patterns of strings in a given formal language.It is defined as four tuples −G=(V, ... Read More
Bhanu Priya
710 Views
For each of the following languages, draw the finite automata (FA) accepting it.{a, b}*{a}The language states that the automata accept the strings containing any number of a's and b's and finally ending in a.The finite state automaton for the language is as follows −{a, b}*{b, aa}{a, b*}The language states that ... Read More
Bhanu Priya
852 Views
ProblemEliminate epsilon, unit and the useless symbols for the given grammar and rewrite it into CNF.S->0E0|1FF| εE->GF->S|EG->S| εSolutionIn the given grammar, we will first remove the null production. There are two null productions in the grammar, as given below −S ==> εG ==> εSo, remove null production and rewrite all ... Read More
Bhanu Priya
826 Views
ProblemGenerate a Chomsky normal form (CNF) for the following context free grammar (CFG).S->aAa|bBb|eA->C|aB->C|bC->CDE|eD->A|B|abSolutionFollow the steps mentioned below to generate a CNF for the given CFGStep 1 − Eliminate ∧ -productionsWe can delete, erase or ∧ -productions double time repeated.S --> aAa | bBb | ∧A --> a | ∧B --> ... Read More
Bhanu Priya
16K+ Views
ProblemConvert the given grammar into Chomsky's Normal Form (CNF)S->AAA|BA->aA|BB-> εSolutionFollow the steps given below to convert CFG to CNF −Step 1 − Eliminate epsilon productionsTo eliminate epsilon productions, the variable which is producing epsilon must be replaced on the RHS of all other productions for the epsilon production to be removed.Replacing ... Read More
Bhanu Priya
5K+ Views
All grammars are not always optimized, which means the grammar may consist of some extra symbols (non-terminals) which increase the length of grammar.So, we have to reduce the grammar by removing such useless symbols.PropertiesThe properties to reduce grammar are explained below −Each non-terminal and terminal of G appears in the ... Read More
Bhanu Priya
385 Views
The star height of Regular expression (RE) is nothing but the depth of Kleene stars in the theory of computation (TOC).For example, a+b the star height is 0(a+b)* the star height is 1(a*+b*)* the star height is 2 …….Star height is used to indicate the structural complexity of regular languages ... Read More
Bhanu Priya
9K+ Views
Chomsky’s Normal Form Stands as CNF.A context free grammar is in CNF, if the production rules satisfy one of the following conditionsIf there is start Symbol generating ε. Example − A-> εIf a non-terminal generates two non-terminals. Example − S->ABIf a non-terminal generates a terminal. Example − S->aExampleLet's take G1 ... Read More
Bhanu Priya
1K+ Views
A context free grammar (CFG) is a forma grammar which is used to generate all possible patterns of strings in a given formal language.It is defined as four tuples −G=(V, T, P, S)Where, G is a grammar, which consists of a set of production rules. It is used to generate ... Read More
Bhanu Priya
3K+ Views
A grammar with at most one variable at the right side of production is called linear grammar.Following is an example of the linear grammar −S→aSb/εHere, if you observe, we can write the same production by dividing …..S→AbA→aAbA→εLeft Linear GrammarA grammar is left linear grammar where all non-terminals in the right ... Read More