I have a simple context free grammar $(\{A\}, \{(,)\}, R, A)$, which consists of this one production rule:
$A \rightarrow AA\, \vert\, (A)\, \vert\, \epsilon$
I believe this is ambiguous! For example, I can represent "()" like this:
I'm sure there are an infinite number of these. I've attempted to make the grammar unambiguous whilst ensuring that the same language is accepted:
$A \rightarrow AA\, \vert\, B$
$B \rightarrow (C)$
$C \rightarrow \epsilon$
How can I be sure that this captures the same language and is no longer ambiguous?