What do you mean by Derivation of Grammar?
In the theory of computation derivation is
the process of deriving or generating a language from the given
production rules. In this non-terminal are replaced by the corresponding
strings of the right-hand side (RHS) of the production. But if there is more
than one non-terminal, then which should be replaced first must be determined
by derivation.
Depending on this selection, the
derivation is divided into two parts:
Leftmost derivation: A derivation is called a leftmost derivation if we replace only
the leftmost non-terminal by some production rule at each step of the
generating process of the language from the grammar. |
Rightmost derivation: A derivation is called a rightmost derivation if we replace only
the rightmost non-terminal by some production rule at each step of the
generating process of the language from the grammar. |
Construct the string 0100110 from the following grammar by using
i) Leftmost derivation ii) Rightmost derivation
S → 0S/1AA
A → 0/1A/0B
B → 1/0BB
Solution:
i) Leftmost Derivation
S → 0S → 01AA → 010BA → 0100BBA → 01001BA → 010011A → 0100110
(The non-terminals that are replaced are represent in red.)
ii) Rightmost Derivation
S → 0S → 01AA → 01A0 → 010B0 → 0100BB0 → 0100B10 → 0100110
(The non-terminals that are replaced are represent in red.)
Also, Study about:
- Mealy Machine
- Moore Machine
- Rice Theorem
- Brief about Turing Machine
- Multi Dimension Turing Machine
- Multiple Turing Machine
- Parikh Theorem in TOC
- Parse Tree or Derivation Tree
- What do you Understand by Derivation
- MyHill Nerode Theorem
- Minimize Myhill Nerode Theorem
- Push Down Automata
- Know Where we use Automata
- What do you understand by Derivation of Grammar
- What is Context-free Grammar
- Example based on CFG
- Regular Expression in TOC
- What is Two-way infinite Turing machine?
- Example to generate Parse tree from the given grammar
Also Read, some interview tips
- Why Should I Hire You?
- What are your weaknesses?
- What are your greatest strengths?
- Tell me about yourself.
- What's the reason behind leaving your current position at your company?
- Do You Know how the power of Keywords impacts on Resume?
- Top 8 Proofreading Tips and Techniques in 2022.
- Top Ten Technical Resume Writing Tips in 2022.
- Tips for your resume before you get entry to Job Market
- What Questions you can ask HR during the Interview.
- How to make an impressive resume?
- Best Resume writing Technique.
- What Questions you can ask HR during the Interview.
No comments