Exemplo n.º 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;
        }
Exemplo n.º 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)));
        }
Exemplo n.º 3
0
 public LalrReduce(GrammarProduction production)
 {
     this.Production = production;
 }