title: BNF ambiguities
body: <p>"Compiler construction" book  gives an example of the original definition of Algol 60. They contain ambiguities.</p>
  
  <p>Find at least two different structures for</p>
  
  <pre><code>IF a THEN b ELSE c=d
  </code></pre>
  
  <p>There is part of definition</p>
  
  <pre><code>unconditional Statement = basicStatement | forStatement | compoundStatement | ... .
  ifStatement = "IF" BooleanExpression "THEN" unconditionalStatement.
  conditionalStatement = ifStatement | ifStatement "ELSE" statement.
  
  statement = unconditionalStatement | conditionalStatement. 
  </code></pre>
  
  <p>so then, since:</p>
  
  <pre><code>A "else" B, and A =&gt; "if" a "then" b
  </code></pre>
  
  <p>we gets:</p>
  
  <pre><code>if a then b else B
  </code></pre>
  
  <p>and it seems, <code>B</code> is <code>c=d</code></p>
  
  <p>Where is ambiguities?
  How to find two different structures?</p>