We use viable prefixes (Aho and Johnson, 1974) to indicate all possible target strings the translations of each node should starts with.
given a tree node to expand, our algorithm can drop immediately to target terminals no matter whether there is a gap or not.