How to build logic to make context free grammar?

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

The discussion centers on constructing context-free grammar (CFG) with specific production rules: S -> AB, A -> aA | a, and B -> ab | aBb. The participant expresses a lack of understanding regarding the logic behind these rules and emphasizes that memorization is insufficient for grasping CFG concepts. They acknowledge that deriving strings from these rules resembles solving a puzzle and that practice is essential for mastery, despite the absence of a mechanical process for generating CFG.

PREREQUISITES
  • Understanding of context-free grammar (CFG)
  • Familiarity with production rules and derivation trees
  • Basic knowledge of formal languages and automata theory
  • Experience with parsing techniques
NEXT STEPS
  • Study the Chomsky hierarchy of formal languages
  • Learn about parsing algorithms such as CYK and Earley parser
  • Explore the concept of derivation trees in CFG
  • Practice constructing CFGs for various languages and strings
USEFUL FOR

This discussion is beneficial for computer science students, linguists, and software developers interested in formal language theory and parsing techniques.

shivajikobardan
Messages
637
Reaction score
54
Homework Statement
Context free grammar
Relevant Equations
None
1636738772910.png

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.
 
Physics news on Phys.org
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).
 

Similar threads

  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
Replies
2
Views
2K
Replies
3
Views
1K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K