How to build logic to make context free grammar?

  • Topic: Comp Sci 
  • Thread starter shivajikobardan
  • Start date
  • Tags Tags
    Build Logic
2 replies · 2K views · last reply
shivajikobardan
Messages
637
Reaction score
54
Homework Statement
Context free grammar
Relevant Equations
None
Slide titled Example giving the language L = {a^m b^n : m > n}, its CFG with V = {S, T}, Σ = {a, b}, rules S → aS | aT and T → aTb | ε, and the derivation of aaab.

I already have the solution.

I also have another solution for this-:

S->AB

A->aA/a

B->ab/aBb

But my issue is I am memorizing them, I am not understanding how this came up. Please explain the logic building behind this.
 
I don't think there is any "logic" to deriving a specific string of terminals from the "rules". I am sure there are exhaustive methods that can be performed by a machine. For us, it is kind of a puzzle.
 
I mean just some initution to understand why we came to this solution I mean would be helpful. I know there is no mechanical process for this. It is all practice. But my problem is I am confused while practicing. (I am clear about this tho so don't waste time on this now).