Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Give CFG for the following languages, a n b m where m = n-1 and n = 1,2,3… Some

ID: 3637025 • Letter: G

Question

Give CFG for the following languages,
anbm where m = n-1 and n = 1,2,3…
Some words belonging to this language are, a , aab , aaabb , aaaabbb , ….
anb2n where n = 1,2,3…
Some words belonging to this language are, abb , aabbbb , aaabbbbbb , ….

Explanation / Answer

a) S -> aT T -> aTb | e where S is the start symbol, e is the null string Basically, we start with the symbol S and use the transition rules stated above to generate the strings of the grammar. So, for example, say we need to generate aaabb. This is how that proceeds: S -> aT -> aaTb (using T -> aTb) -> aaaTbb (using T -> aTb) -> aaabb (using T -> e) b) S -> aSbb | e where S is the start symbol, e is the null string So, for example, say we need to generate aabbbb. This is how that proceeds: S -> aSbb -> aaSbbbb (using S -> aSbb) -> aabbbb (using S -> e)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote