title: Grammar that allows arbitrary rules order
body: <p>I'm (trying) to design a domain-specific language (I called it "Fahrenheit") for designing citation styles.</p>
  
  <p>A program written in Fahrenheit:</p>
  
  <ul>
  <li>MUST have exactly one <code>citation</code> block</li>
  <li>MAY have zero or more <code>macro</code> blocks.</li>
  </ul>
  
  <p>Here's a simplified yet valid example:</p>
  
  <pre><code>macro m1
    "Hello World!"
  end
  
  macro m2
    "Hello World!"
  end
  
  citation
    "Hello World!"
  end
  </code></pre>
  
  <p>This grammar will recognise the above code as syntactically correct:</p>
  
  <pre><code>style = macro* citation
  
  (*  example of macro definition
  
      macro hw
          "Hello World!"
      end
  
      *)
  
  macro = &lt;'macro'&gt; #'[a-z0-9]+' statement+ end
  
  citation = &lt;'citation'&gt; statement+ end
  
  statement = #'".*?"'
  
  &lt;end&gt; = &lt;'end'&gt;
  </code></pre>
  
  <p>However the ordering of "blocks" (e.g <code>macro</code> or <code>citation</code>) shouldn't matter.</p>
  
  <p><strong>Question:</strong> How should I change my grammar so that it recognises the following program as syntactically correct?</p>
  
  <pre><code>macro m1
    "Hello World!"
  end
  
  citation
    "Hello World!"
  end
  
  macro m2
    "Hello World!"
  end
  </code></pre>
  
  <p><em>PS: I'm intending to add other optional blocks which order is also irrelevant.</em></p>