- 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 the removal of useless symbols
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.
Properties
The properties to reduce grammar are explained below −
- Each non-terminal and terminal of G appears in the derivation of some word in L
- There should not be any production as X->Y where X and Y are non-terminals.
- If epsilon is not in language L then, there need not be in the production X-> ε.
The use of reducing grammar is as follows −
Definition
A symbol X is useful if there is a derivation of the form
S=>* aXb =* w
Otherwise, the symbol X is useless. Note that in a derivation, finally, we should get a string of terminals and all these symbols must be reachable from the start symbol S.
Those symbols and productions which are not at all used in the derivation are useless.
Example
Consider the following example for removing symbol
S->aAa|bBb| ε A->C|a B->C|b C->CDE| ε D->A|B|ab
The useless symbols from the given grammar is E. Because E is not a derivative on the right hand side (RHS).
After removing the useless symbol, the production is as follows
S->aDa|bDb D->a|b|ab
- Related Articles
- Eliminate epsilon, unit and useless symbols and rewrite into CNF
- Explain the meaning of the following equation: p = m × v where symbols have their usual meanings.
- Explain the meaning of the following equation of motion: $v=u+at$, where symbols have their usual meanings.
- Are new HTML5 elements like and useless?
- Explain the meaning of the following equation : $p=m\times v$ where symbols have their usual meanings.
- Explain the meaning of the following equation : $F=m\times a$, where symbols have their usual meanings.
- Can variables have symbols in it like the percentage symbols %?
- Maximum removal from array when removal time >= waiting time in C++
- How to delete useless images in your whatsapp automatically
- Side Effects of Gallstones and Gallbladder Removal
- HTML Symbols
- Palindrome Removal on C++
- Explain the following terms-1. Periodic Table 2. Elements 3. Compounds 4. Chemical Symbols 5. Chemical Formula
- Conditional removal of labels in Matplotlib pie chart
- Home Remedies for Hair Removal
