# Unambiguous CFG for $a^ib^j$ where $i \le j \le 2i$

could you please help me for finding an unambiguous CFG for the following expression: $a^ib^j$ where $i \le j \le 2i$

• Welcome to Computer Science! Note that you can use LaTeX here to typeset mathematics in a more readable way. See here for a short introduction. (I have edited your post accordingly.) – FrankW Sep 5 '14 at 20:22
• Hint. Try to do it for j=i, Then try to do it for j=2i. That should give you a feel for the problem. – babou Sep 5 '14 at 20:57
• Already came up with some ideas none of them is unambiguous... – suat Sep 5 '14 at 23:24
• Nice question. The ambiguous solution is given elsewhere on this site. Now get some order on the two "competing" productions. Like the question, sonce the language is an example that cannot be accepted by a deterministic PDA. – Hendrik Jan Sep 5 '14 at 23:59
• If you told us what you tried, we might better understand how to help you. Just giving you the answer would not teach you anything. Did uou try my suggestions, or the suggestion of Jan Hendrik? – babou Sep 6 '14 at 7:20

$S \rightarrow$ $aSb$ | $J$
$J \rightarrow aJbb$ | $ε$