title: Python NLTK parsing recursion error with custom grammar
body: <p>I keep getting a recursive error when i try to run the code below</p>
  
  <pre><code>import nltk
  from nltk import Nonterminal, nonterminals, Production, CFG
  from nltk.parse import RecursiveDescentParser
  from nltk.parse import ShiftReduceParser
  from nltk.parse import ChartParser
  from nltk.parse.generate import generate, demo_grammar
  from nltk import CFG
  
  grammar = CFG.fromstring("""
  S -&gt; NP VP 
  NP -&gt; Det Nom | PropN | NP PP  
  Nom -&gt; Adj Nom | N
  VP -&gt; V NP | V S | VP PP
  PP -&gt; P NP
  PropN -&gt; 'Bill' | 'Bob' | 'He'
  Det -&gt; 'the' | 'a' | 'an' | 'some'
  N -&gt; 'bear' | 'squirrel' | 'park' | 'block' | 'table' | 'river' | 'dog' | 'dogs' | 'pasta'| 'anchovies' | 'restaurant' | 'fork'
  Adj -&gt; 'angry' | 'frightened' | 'furry'
  V -&gt; 'chased' | 'saw' | 'Put' | 'eats' | 'eat' | 'chase'
  P -&gt; 'on' | 'in' | 'along' | 'with'
  """)
  
  rd = RecursiveDescentParser(grammar)
  sr = ShiftReduceParser(grammar)
  cp = ChartParser(grammar)
  s1 = 'Bill Put the block on the table'.split()
  s2 = 'Bob chased a bear in the park along the river'.split()
  s3 = 'Bill saw Bob chase the angry furry dog'.split()
  s4 = 'an bear eat an squirrel'.split()
  s5 = 'the dogs eats'.split()
  s6 = 'He eats pasta with some anchovies in the restaurant'.split()
  s7 = 'He eats pasta with a fork in the restaurant'.split()
  
  for t in rd.parse(s1):
      print(t)
  </code></pre>
  
  <p>So far only the chart parser works but I would also like the other 2 parsers to work as well. i have a feeling the error has something to do with my grammar variable however i have not been able to find a fix.</p>