What logic is used to build context free grammar for L= a^m b^n; m>n

  • Context: MHB 
  • Thread starter Thread starter shivajikobardan
  • Start date Start date
  • Tags Tags
    Build Logic
Click For Summary
SUMMARY

The discussion focuses on constructing a context-free grammar (CFG) for the language L = a^m b^n where m > n. The derivation process involves applying the rule S → aS n times to generate strings of the form a^nS, followed by S → aT to transition to a^{n+1}T. Subsequently, the rule T → aTb is applied m times to produce a^{n+1}a^mTb^m, and finally, T → ε concludes the derivation, yielding the strings a^{n+m+1}b^m. This CFG effectively captures the required language structure.

PREREQUISITES
  • Understanding of context-free grammars (CFG)
  • Familiarity with derivation processes in formal languages
  • Knowledge of production rules and their applications
  • Basic concepts of language theory and automata
NEXT STEPS
  • Study the Chomsky hierarchy and its implications for CFGs
  • Explore derivation trees and their significance in grammar analysis
  • Learn about parsing techniques for context-free languages
  • Investigate the Pumping Lemma for context-free languages
USEFUL FOR

This discussion is beneficial for students of computer science, linguists studying formal languages, and software developers involved in compiler design and language processing.

shivajikobardan
Messages
637
Reaction score
54
1636741535608.png
I have the solution but I am unable to decode the solution, how did we come up here? can you tell me that?
 
Technology news on Phys.org
Is the problem "Derive $aaab$? Then you are given an explicit derivation. Do you know the definition of a derivation in the context of grammars? What exactly is not clear?
 
No. I understand derivation. My problem is that I am not understanding how we came up to this solution of CFG. I want that problem solving skill to learn rather than trying to memorize this. So I am asking this. There must be some patterns of questions there right? Can you guide me a bit in this question?
 
Applying rule $S\to aS$ $n$ times where $n\ge0$ allows building strings of the form $a^nS$ from $S$. Then the only different thing to do is to apply $S\to aT$ to produce $a^{n+1}T$. After that, applying $T\to aTb$ $m$ times where $m\ge0$ produces $a^{n+1}a^mTb^m$. Finally, $T\to\varepsilon$ finishes the derivation and produces $a^{n+m+1}b^m$. These are the only strings (for some $n,m\ge0$) that one can generate using this grammar.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 29 ·
Replies
29
Views
4K
  • · Replies 3 ·
Replies
3
Views
909
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
5K