title: Fixing ambiguities on a Lemon parser grammar
body: <p>I'm having what appears to be an ambiguous grammar. It seems like there are some problems under FileText since there is no conflict when I run only the top part (above FileText). Can anyone help me to spot where my issue is? I believe my tree looks fine. Here's an input sample:</p>
  <p><code> lemon AND (#Chapter1.Title : &quot;BNF grammar&quot;   AND #Chapter10.Title : (&quot;BNF notion&quot; OR &quot;EBNF notion&quot;))</code></p>
  <p>error:</p>
  <pre><code>     QUOT shift        17
       QUOT reduce       14  ** Parsing conflict **
        STR shift-reduce 20  subval ::= STR
        STR reduce       14  ** Parsing conflict **
       LPAR shift         7  
       LPAR reduce       14  ** Parsing conflict **
         WS shift-reduce 10  space ::= WS
         WS reduce       14  ** Parsing conflict **
         op shift         9
      space shift        12
       text shift-reduce 15  filetext::= filetext text
   subvalue shift-reduce 15  filetext::= filetext text /*because subval==text
   {default} reduce      14  location ::= location COLON filetext
  </code></pre>
  <p>grammar:</p>
  <pre><code>%left::=AND.
  %left::=OR.
  
  book::= expr.
  
  expr::= expr term.
  expr::= expr op term.
  expr::= term.
  
  term::= value.
  term::= QUOT STR QUOT.
  
  value::= atom.
  value::= LPAR expr RPAR.
  
  atom::= STR.
  atom::= file.
  
  op::= space AND space.
  op::= space OR space.
  
  space::= WS.
  space::= space WS.
  
  file::= location COLON filetext.
  
  location::= SHARP STR PERIOD STR.
  
  filetext::= filetext text.
  filetext::= filetext op text.
  filetext::= text.
  
  text::= subvalue.
  text::= QUOT STR QUOT.
  
  subvalue::= subatom.
  subvalue::= LPAR filetext RPAR.
  
  subatom::= STR.
  </code></pre>
  <p>For what is worth, the tree came up with and derived my grammar from:</p>
  <p><a href="https://i.stack.imgur.com/CYRDl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CYRDl.png" alt="enter image description here" /></a></p>