Give a context free grammar for the language

63 Views Asked by At

I need to formulate a context free grammar for $A =\{(ab)^n(ab)^n | n ≥ 1 \}$.

My try:

$S → abS|abT$

$T → abS|ε $

I am not sure if this production is correct. I am new to the subject.

1

There are 1 best solutions below

0
On

Hint: Use $S \rightarrow abTab$ as your start rule, and make the rule for $T$ very similar, only that $T$ needs to be able to terminate the derivation.