# Find an unambiguous grammar [closed]

S → aS | aSbS | (empty) where the alphabet is {a,b}

in other words, the set of strings where any prefix has at least as many 'a's as 'b's.

• What exactly are you asking for? It is not clear at all. You have given a grammar that does not do what you specify. – lPlant Jul 24 '14 at 15:50
• sry about the typo! i gave an ambiguous grammar of that. what's an unambiguous one for it? – hollow7 Jul 24 '14 at 15:57

$S \to aS \mid A S \mid \epsilon$
$A \to a AAb \mid \epsilon$