Input grammar parsing