Skip to main content
added 28 characters in body
Source Link
Bader Abu Radi
  • 4.9k
  • 1
  • 11
  • 38

You can simply consider the following grammar: $$ S\to S_1 b S_1$$ where $S_1$ is the start variable of a grammar for the language of words $w$ with $|w|_a = |w|_b$. Correctness is self-explanatory.

So using the grammar you havewrote, you get the following grammar: $$ S\to T b T$$

$$ T \to aTbT| bTaT | \epsilon$$

You can simply consider the following grammar $$ S\to S_1 b S_1$$ where $S_1$ is the start variable of a grammar for the language of words $w$ with $|w|_a = |w|_b$. Correctness is self-explanatory.

So you have the following grammar: $$ S\to T b T$$

$$ T \to aTbT| bTaT | \epsilon$$

You can simply consider the following grammar: $$ S\to S_1 b S_1$$ where $S_1$ is the start variable of a grammar for the language of words $w$ with $|w|_a = |w|_b$. Correctness is self-explanatory.

So using the grammar you wrote, you get the following grammar: $$ S\to T b T$$

$$ T \to aTbT| bTaT | \epsilon$$

Source Link
Bader Abu Radi
  • 4.9k
  • 1
  • 11
  • 38

You can simply consider the following grammar $$ S\to S_1 b S_1$$ where $S_1$ is the start variable of a grammar for the language of words $w$ with $|w|_a = |w|_b$. Correctness is self-explanatory.

So you have the following grammar: $$ S\to T b T$$

$$ T \to aTbT| bTaT | \epsilon$$