/// <summary> /// Initializes a new instance of the Concrete class. /// </summary> /// <param name="name">Name of concrete grammar</param> /// <param name="flags">Grammar flags</param> /// <param name="linDefs">Default linearization definitions</param> /// <param name="linRefs">Default linearization references</param> /// <param name="prods">List of production sets</param> /// <param name="cncCats">Dictionary containing concrete categories</param> /// <param name="fId">Function id</param> /// <param name="defaultStartCat">Default starting category</param> public Concrete(string name, Dictionary<string, Literal> flags, LinDef[] linDefs, LinDef[] linRefs, ProductionSet[] prods, Dictionary<string, ConcreteCategory> cncCats, int fId, string defaultStartCat) { this.Name = name; this.flags = flags; this.Prods = prods; this.CncCats = cncCats; this.FId = fId; this.startCat = defaultStartCat; this.LinDefs = linDefs; // Populate helper dictionary for production set // TODO check if productionsets can have the same ID? this.Productions = new Dictionary<int, List<Production>>(); foreach (ProductionSet ps in this.Prods) { var tempProd = new List<Production>(); foreach (Production p in ps.Prods) { tempProd.Add(p); } this.Productions[ps.ID] = tempProd; } }
/// <summary> /// Read a list of ProductionSets /// </summary> /// <param name="cncFuns">List of Concrete Functions</param> /// <returns>List of ProductionSets</returns> private ProductionSet[] GetListProductionSet(ConcreteFunction[] cncFuns) { int npoz = this.GetInt(); ProductionSet[] tmp = new ProductionSet[npoz]; for (int i = 0; i < npoz; i++) { tmp[i] = this.GetProductionSet(cncFuns); } return tmp; }