/// <summary> /// Starts reading the PGF object /// </summary> /// <returns>PGF object</returns> public CSPGF.PGF ReadPGF() { Dictionary<string, int> index = null; for (int i = 0; i < 2; i++) { this.version[i] = this.BE16toLE16(this.binreader.ReadInt16()); } if (this.version[0] == 1) { throw new PGFException("This library does not support version 1.x of the PGF format."); } else if (this.version[0] == 2 && this.version[1] == 1) { PGF pgf = new PGF(this.inputstream, this.binreader); Dictionary<string, Literal> flags = pgf.GetFlags(index); Abstract abs = pgf.GetAbstract(); CSPGF.PGF pgfobj = new CSPGF.PGF(this.version[0], this.version[1], flags, abs, pgf.GetConcretes(abs.StartCat(), index)); pgf.Dispose(); return pgfobj; } else { throw new PGFException("This library does not support this version of the PGF file format."); } }
/// <summary> /// Initializes a new instance of the Linearizer class. /// Linearizes an expression to a bracketed token /// and further on to a string /// not implemented to dependent categories, implicit argument, /// and higher-order abstract syntax /// </summary> /// <param name="pgf">PGF-file containing the concrete grammar</param> /// <param name="concrete">Concrete grammar</param> public Linearizer(CSPGF.PGF pgf, Concrete concrete) { this.pgf = pgf; this.cnc = concrete; this.linProd = this.GetLProductions(); }