1

I want to find Context Free Grammar for L={ a^n b^m : n <= m+3 , n,m>=0}

What I have so far

S -> AAAB
A -> a | ε
B -> aBb | Bb | ε

Does this make any sense?

  • Welcome to Stack Overflow. Please take the [tour] to learn how Stack Overflow works and read [ask] on how to improve the quality of your question. Then check the [help/on-topic] to see which questions are on-topic on this site. You might want to delete this question and ask it on https://cs.stackexchange.com/ instead, but check the help pages there first. – Progman Sep 14 '22 at 15:18

1 Answers1

1

First of all this CFG should work properly But the CFG below is more readable :

S -> aSb | A | B
A -> a | aa | aaa | ε
B -> bB | ε