示例#1
0
        public LalrItem(GrammarProduction production, int parsingPoint, TerminalSymbol lookahead)
        {
            if (this.ParsingPoint > production.Body.Count || ParsingPoint < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(parsingPoint));
            }

            this.Production   = production;
            this.ParsingPoint = parsingPoint;
            this.Lookahead    = lookahead;
        }
示例#2
0
        private bool TestNullable(GrammarProduction prod)
        {
            if (prod.Body.Count == 0)
            {
                return(true);
            }

            if (prod.Body.Any(s => s is TerminalSymbol))
            {
                return(false);
            }

            return(prod.Body.All(s => mNullableSymbols.Contains(s as NonterminalSymbol)));
        }
示例#3
0
 public LalrReduce(GrammarProduction production)
 {
     this.Production = production;
 }