class_docstr: A ``ShiftReduceParser`` that allows you to setp through the parsing
  process, performing a single operation at a time.  It also allows
  you to change the parser's grammar midway through parsing a text.
  
  The ``initialize`` method is used to start parsing a text.
  ``shift`` performs a single shift operation, and ``reduce`` performs
  a single reduce operation.  ``step`` will perform a single reduce
  operation if possible; otherwise, it will perform a single shift
  operation.  ``parses`` returns the set of parses that have been
  found by the parser.
  
  :ivar _history: A list of ``(stack, remaining_text)`` pairs,
      containing all of the previous states of the parser.  This
      history is used to implement the ``undo`` operation.
  :see: ``nltk.grammar``
class_docstr_tok: ["A","``","ShiftReduceParser","``","that","allows","you","to","setp","through","the","parsing","process",",","performing","a","single","operation","at","a","time",".","It","also","allows","you","to","change","the","parser","'s","grammar","midway","through","parsing","a","text",".","The","``","initialize","``","method","is","used","to","start","parsing","a","text",".","``","shift","``","performs","a","single","shift","operation",",","and","``","reduce","``","performs","a","single","reduce","operation",".","``","step","``","will","perform","a","single","reduce","operation","if","possible",";","otherwise",",","it","will","perform","a","single","shift","operation",".","``","parses","``","returns","the","set","of","parses","that","have","been","found","by","the","parser",".",":","ivar","_history",":","A","list","of","``","(","stack",",","remaining_text",")","``","pairs",",","containing","all","of","the","previous","states","of","the","parser",".","This","history","is","used","to","implement","the","``","undo","``","operation",".",":","see",":","``","nltk.grammar","``"]
docstr: Use ``production`` to combine the rightmost stack elements into
  a single Tree.  If ``production`` does not match the
  rightmost stack elements, then do nothing.
  
  :return: The production used to reduce the stack, if a
      reduction was performed.  If no reduction was performed,
      return None.
  
  :rtype: Production or None
docstr_tok: ["Use","``","production","``","to","combine","the","rightmost","stack","elements","into","a","single","Tree",".","If","``","production","``","does","not","match","the","rightmost","stack","elements",",","then","do","nothing",".",":","return",":","The","production","used","to","reduce","the","stack",",","if","a","reduction","was","performed",".","If","no","reduction","was","performed",",","return","None",".",":","rtype",":","Production","or","None"]
code: def reduce(self, production=None):
      """
      Use ``production`` to combine the rightmost stack elements into
      a single Tree.  If ``production`` does not match the
      rightmost stack elements, then do nothing.
  
      :return: The production used to reduce the stack, if a
          reduction was performed.  If no reduction was performed,
          return None.
  
      :rtype: Production or None
      """
      self._history.append((self._stack[:], self._remaining_text[:]))
      return_val = self._reduce(
          self._stack, self._remaining_text, production
      )
  
      if not return_val:
          self._history.pop()
      return return_val
  
imports: from nltk.grammar import Nonterminal
  from nltk.parse.api import ParserI
  from nltk.tree import Tree
label_desc: Use image node_id 8 for calling the SteppingShiftReduceParser obj's underlying member method code with example usage: obj.reduce(production) and returns: return_val