title: How to resolve ambiguity in the definition of an LR(1) grammar?
body: <p>I am writing a Golang compiler in OCaml, and argument lists are causing me a bit of a headache.  In Go, you can group consecutive parameter names of the same type in the following way:</p>
  
  <pre><code>func f(a, b, c int)  ===  func f(a int, b int, c int)
  </code></pre>
  
  <p>You can also have a list of types, without parameter names:</p>
  
  <pre><code>func g(int, string, int)
  </code></pre>
  
  <p>The two styles cannot be mix-and-matched; either all parameters are named or none are.</p>
  
  <p>My issue is that when the parser sees a comma, it doesn't know what to do.  In the first example, is <code>a</code> the name of a type or the name of a variable with more variables coming up?  The comma has a dual role and I am not sure how to fix this.  </p>
  
  <p>I am using the Menhir parser generator tool for OCaml.</p>
  
  <p>Edit: at the moment, my Menhir grammar follows exactly the rules as specified at <a href="http://golang.org/ref/spec#Function_types" rel="noreferrer">http://golang.org/ref/spec#Function_types</a></p>