Example #1
0
        private void PredictAycockHorspool(NonterminalState evidence, int location)
        {
            var dottedRule = evidence.DottedRule.Next;

            if (Chart.Contains(location, dottedRule, evidence.Origin))
            {
                return;
            }

            var aycockHorspoolState = EarleyItems.NewState(dottedRule, evidence.Origin);

            if (Chart.Add(location, aycockHorspoolState))
            {
                Log(predName, location, aycockHorspoolState);
            }
        }
Example #2
0
        private void Predict(NonterminalState evidence)
        {
            var nonTerminal = evidence.DottedRule.PostDot as Nonterminal;

            Debug.Assert(nonTerminal != null);
            var productionsForNonterminal = Grammar.ProductionsFor(nonTerminal);

            foreach (var production in productionsForNonterminal)
            {
                PredictProduction(Location, production);
            }

            if (nonTerminal.IsNullable)
            {
                PredictAycockHorspool(evidence, Location);
            }
        }
Example #3
0
 public bool Add(NonterminalState state)
 {
     return(this.nonterminalStates.Add(state));
 }