I am writing this CFG to solve the problem:
$S \to ASBSC$
$A \to aAe ~|~ ε$
$B \to aBd ~|~ ε$
$C \to bcC ~|~ ε$
Is this correct or not?
I am writing this CFG to solve the problem:
$S \to ASBSC$
$A \to aAe ~|~ ε$
$B \to aBd ~|~ ε$
$C \to bcC ~|~ ε$
Is this correct or not?
Strings in your grammar could potentially terminate with a sequence of $bc$s because of the following, which is not desired.
$S \rightarrow ASBSC$
$C \rightarrow bcC \ | \ \epsilon$
The correct grammar in this case would be:
$S \rightarrow aSe \ | \ A \ | \ \epsilon$
$A \rightarrow aAd \ | \ B \ | \ \epsilon$
$B \rightarrow bBc \ | \ \epsilon$