title: Ruby EBNF COMPSTMT iteration misunderstanding
body: <p>Here is a basic Ruby program:</p>
  <pre class="lang-rb prettyprint-override"><code>puts 1
  puts 1
  puts 1
  puts 1
  puts 1
  puts 1
  puts 1
  </code></pre>
  <p>Here are the top rules of the BNF syntax for Ruby (shortened):
  source: <a href="https://github.com/goruby/goruby/blob/master/goruby.bnf" rel="nofollow noreferrer">https://github.com/goruby/goruby/blob/master/goruby.bnf</a> or <a href="https://cse.buffalo.edu/%7Eregan/cse305/RubyBNF.pdf" rel="nofollow noreferrer">https://cse.buffalo.edu/~regan/cse305/RubyBNF.pdf</a></p>
  <pre class="lang-none prettyprint-override"><code>PROGRAM         : COMPSTMT ;
  
  COMPSTMT        : STMT
                  | COMPSTMT TERM
                  | COMPSTMT TERM EXPR
                  | COMPSTMT TERM EXPR TERM ;
  
  STMT            : &quot;BEGIN&quot; &quot;{&quot; COMPSTMT &quot;}&quot;
                  | &quot;END&quot; &quot;{&quot; COMPSTMT &quot;}&quot;
                  | EXPR ;
  
  </code></pre>
  <p>Since a PROGRAM is only one COMPSTMT, and a COMPSTMT is never just a {COMPSTMT}
  , how is this possible for the interpreter to validate my code ? I can't draw the grammar graph leading to my program.</p>
  <p>It should only authorize two expressions, no more (COMPSTMT TERM EXPR TERM).</p>
  <p>Does Ruby put a begin/end under the hood to authorize an iteration of COMPSTMT, or am I misunderstanding the rules ?</p>