When we left factor a grammar and make it deterministic, it doesnt make the grammar unambiguous if it was ambiguous. Then how can we say that every deterministic grammar is unambiguous?? Its confusing :(
By removing Left Factor( It is done to avoid back-tracing by the parser. ), we make the productions as Deterministic but not the Grammar.
Eg :-
S → aA | a BC
A → bab
B → b
C → ab
By removing Left Factoring, it is looking as
S → aD
D → A | BC
A → bab
B → b
C → ab
Now it is left factored ( Note that, there is NO BACK-TRACING ) , but is it Unambiguous Grammar ?
NO, due to abab can be derived in two ways.
Derivation 1 :-
S ---> a D
---> a A
---> a bab
Derivation 2 :-
S ---> a D
---> a BC
---> a b C
---> a b ab