private void InitializeProductionsByGrammarSymbolsInRightHandSide() { foreach (var v in Cfg.Variables.Concat(Cfg.GetNonVariableSymbols()).ToList()) { productionsByGrammarSymbolsInRightHandSide[v] = new List <Production>(); } foreach (var prod in Cfg.GetProductions()) { foreach (var v in prod.Rhs.Distinct().ToList()) { productionsByGrammarSymbolsInRightHandSide[v].Add(prod); } } }