# Eliminate ambiguity from CFG

CFG here stands for context-free grammar. I understand that:

1. Deciding whether a CFG $G$ is ambiguous is undecidable.

2. Deciding whether a CFL $L$ is inherently ambiguous is undecidable.

My question is:

Is there an algorithm $A$ to remove ambiguity from an ambiguous grammar $G$ of a NOT inherently ambiguous language $L(G)$?

To specify the behavior of $A$ more precisely, $A$ operates on $G$ and:

1. If $L(G)$ is not inherently ambiguous, $A$ outputs a CFG $G'$ so that $G'$ is not ambiguous and $L(G') = L(G)$.

2. If $L(G)$ is inherently ambiguous, $A$ outputs something arbitrarily.

Is this problem known to be undecidable, or still open? Any comments and links are welcome. Thanks.

-
If $L(G)$ is inherently ambiguous, is it acceptable to run forever, rather than outputting something arbitrary? –  Max Dec 28 '12 at 22:40
@Max I think that's fine. And that seems to relax the problem, but can you prove it? –  cyker Dec 30 '12 at 5:26