private void InitNonTerminalData()
 {
     foreach (NonTerminal nt in Data.NonTerminals)
     {
         NtData.GetOrCreate(nt);
     }
 }
 private void CreateProductions()
 {
     Data.Productions.Clear();
     //each LR0Item gets its unique ID, last assigned (max) Id is kept in static field
     LR0Item._maxID = 0;
     foreach (NonTerminal nt in Data.NonTerminals)
     {
         NtData ntInfo = NtData.GetOrCreate(nt);
         ntInfo.Productions.Clear();
         //Get data (sequences) from both Rule and ErrorRule
         BnfExpressionData allData = new BnfExpressionData();
         allData.AddRange(nt.Rule.Data);
         if (nt.ErrorRule != null)
         {
             allData.AddRange(nt.ErrorRule.Data);
         }
         //actually create productions for each sequence
         foreach (BnfTermList prodOperands in allData)
         {
             Production prod = CreateProduction(nt, prodOperands);
             //Add the production to non-terminal's list and to global list
             ntInfo.Productions.Add(prod);
             Data.Productions.Add(prod);
         }//foreach prodOperands
     }
 }