static void Main(string[] args) { GrammarWorkTesting.RunGrammarTests(3); Grammar grammar = new Grammar(); Rule r1 = new Rule("S", new List <Symbol>() { "S", "a", "S", "b" }); Rule r2 = new Rule("S", new List <Symbol>() { "e" }); grammar.AddRule(r1); grammar.AddRule(r2); grammar.SetStartSym("S"); GrammarValidationReport report = grammar.PrecomputeGrammar(); if (report.isSuccessfull) { MarpaParser mp = new MarpaParser(grammar); // RecogniseReport rr = mp.CheckString("eaeaeaeaeaeaebbbbbb"); } }
internal static void RunRecongniserForGrammar(int grammarNumber) { string grammarFilePath = _dirPrefix + _grammarPrefix + grammarNumber.ToString() + _filePostfix; string inputsFilePath = _dirPrefix + _inputsPrefix + grammarNumber.ToString() + _filePostfix; Grammar grammar = GetGrammarFromFile(grammarFilePath); List <string> inputs = GetListOfInputs(inputsFilePath); GrammarValidationReport er = grammar.PrecomputeGrammar(); if (er.isSuccessfull) { CalculateTimeOfRecognise(filePath, grammar, inputs); } }