def _compute_follow(self):
self._follow[self.start_symbol].add(END_OF_INPUT)<EOL>while True:<EOL><INDENT>changed = False<EOL>for nonterminal, productions in self.nonterminals.items():<EOL><INDENT>for production in productions:<EOL><INDENT>for i, symbol in enumerate(production.rhs):<EOL><INDENT>if symbol not in self.nonterminals:<EOL><INDENT>continue<EOL><DEDENT>first = self.first(production.rhs[i + <NUM_LIT:1>:])<EOL>new_follow = first - set([EPSILON])<EOL>if EPSILON in first or i == (len(production.rhs) - <NUM_LIT:1>):<EOL><INDENT>new_follow |= self._follow[nonterminal]<EOL><DEDENT>if new_follow - self._follow[symbol]:<EOL><INDENT>self._follow[symbol] |= new_follow<EOL>changed = True<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if not changed:<EOL><INDENT>break<EOL><DEDENT><DEDENT>
Computes the FOLLOW set for every non-terminal in the grammar.

        Tenatively based on _compute_follow in PLY.