Пример #1
0
        public ParserStackItem Step()
        {
            var stateNumber = State.StateStack.Peek();
            var operation   = ParseTable.Lookup(stateNumber, State.InputStack.Count > 0 ? State.InputStack.Peek() : null);

            operation.Apply(this.State);
            if (operation is ParserReduceOp && (operation as ParserReduceOp).Index == -1)
            {
                // Done!
                return(State.InputStack.Pop());
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
 public Parser(ParseTable table, IEnumerable <TokenizedItem> tokens)
 {
     ParseTable = table;
     State      = new ParserState(tokens);
 }