title: Solve conflict shift/reduce with simple calculator grammar
body: <p>Hello I have just started doing some parsing in bison/yacc. Now my first program already fails. What went wrong? I am using an example from:
  <a href="http://epaperpress.com/lexandyacc/pry1.html" rel="nofollow">original source of tutorial</a></p>
  
  <pre><code>%{
      #include &lt;stdio.h&gt;
      int yylex(void);
      void yyerror(char *);
  %}
  
  
  %token INTEGER
  
  %%
  
  program:
          program expr '\n'         { printf("%d\n", $2); }
          | 
          ;
  
  expr:
          INTEGER                   { $$ = $1; }
          | expr '+' expr           { $$ = $1 + $3; }
          | expr '-' expr           { $$ = $1 - $3; }
          ;
  
  %%
  
  void yyerror(char *s) {
      fprintf(stderr, "%s\n", s);
  }
  
  int main(void) {
      yyparse();
      return 0;
  }
  </code></pre>
  
  <p>Using version 2.4.1 of bison I get this error:</p>
  
  <pre><code>conflicts: 4 shift/reduce
  </code></pre>