added indexing of grammars