Find a CFG for the following language:
$$L = \{a^i b^j a^n b^m \mid i + j = n + m\}$$
I'm not sure how I can do that context free. I know that I have to borrow one char from the left group for each char from the right group. but not sure how.
Find a CFG for the following language:
$$L = \{a^i b^j a^n b^m \mid i + j = n + m\}$$
I'm not sure how I can do that context free. I know that I have to borrow one char from the left group for each char from the right group. but not sure how.
The idea is to use non-terminals $X_{\alpha\beta}$, where $\alpha,\beta \in \{a,b\}$, that support the production $X_{\alpha\beta} \to \alpha X_{\alpha\beta} \beta$. You have to combine them somehow so that you obtain the language $L$, but I'll leave the details to you.