Refactored grammarNeighbors and made it so that usable productions are precomputed