I need to provide a CFG for $L=\{a^{2n}\cdot b^n \cdot a^k | n,k \ge 0\}$ .So I am perplexed on how to account for $a^k$ as $S -> aaSb | \epsilon$ gives me $a^{2n}b^n$ but if I do anything like $S -> aaSbT$ the I start getting garbage like, $aaaaSbTbT$.
Asked
Active
Viewed 32 times
0
-
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Oct 22 '22 at 01:28
-
Are you learning context-free grammar in a math course or by a math book? Where did you find the problem? – Apass.Jack Oct 22 '22 at 04:46
-
@Apass.Jack it's from archives of mathematical tripos examination. – Oswaldo Mobrey Oct 24 '22 at 23:30
-
Ah, the Mathematical Tripos. Nowadays questions about formal grammar are better raised on [cs.se]. – Apass.Jack Nov 07 '22 at 01:37