Question: Did I do this correctly? Question: Construct context-free grammars that generate the following languages (give your answers as a set of rules): {a n b
Did I do this correctly?
Question:
Construct context-free grammars that generate the following languages (give your answers as a set of rules):
- {anbn+kak{a,b}|n0,k0}
Answer:
S | aAbB | AbBa
A | aAb
B | bBa
Possible strings to test on:
n = 0, k = 2
bbaa
SAbBabBabbBaabbaabbaa
n =2, k = 1
aabbba
SaAbBaaAbbBaabbbBaaabbbaaabbba
n = 1, k = 3
abbbbaaa
SaAbBabBabbBaabbbBaaabbbbBaaaabbbbaaaabbbbaaa
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
