Bhanu Priya has Published 1581 Articles

Explain how to convert CFG to CNF

Bhanu Priya

Bhanu Priya

Updated on 12-Jun-2021 12:34:50

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

What are the regular expressions to finite automata?

Bhanu Priya

Bhanu Priya

Updated on 12-Jun-2021 12:29:13

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

Eliminate epsilon, unit and useless symbols and rewrite into CNF

Bhanu Priya

Bhanu Priya

Updated on 12-Jun-2021 12:15:02

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

Generate a CNF for a given context free grammar

Bhanu Priya

Bhanu Priya

Updated on 12-Jun-2021 12:12:15

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

Convert the given Context free grammar to CNF

Bhanu Priya

Bhanu Priya

Updated on 12-Jun-2021 12:10:49

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

Explain the removal of useless symbols

Bhanu Priya

Bhanu Priya

Updated on 12-Jun-2021 12:06:25

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

Explain the Star Height of Regular Expression and Regular Language

Bhanu Priya

Bhanu Priya

Updated on 12-Jun-2021 11:58:55

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

Explain Chomsky normal form in TOC

Bhanu Priya

Bhanu Priya

Updated on 12-Jun-2021 11:58:45

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

Explain the simplification of context free grammar in TOC

Bhanu Priya

Bhanu Priya

Updated on 12-Jun-2021 11:57:47

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

How to convert FA to Left Linear Grammar in TOC?

Bhanu Priya

Bhanu Priya

Updated on 12-Jun-2021 11:55:37

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

Advertisements