Change grammar representation from list of structure to int map