title: How to implement JJTree on grammar
body: <p>I have an assignment to use JavaCC to make a Top-Down Parser with Semantic Analysis for a language supplied by the lecturer. I have the production rules written out and no errors.
  I'm completely stuck on how to use JJTree for my code and my hours of scouring the internet for tutorials hasn't gotten me anywhere.
  Just wondering could anyone take some time out to explain how to implement JJTree in the code?
  Or if there's a hidden step-by-step tutorial out there somewhere that would be a great help!</p>
  
  <p>Here are some of my production rules in case they help.
  Thanks in advance!</p>
  
  <pre><code>void program() : {}
  {
    (decl())* (function())* main_prog()
  }
  
  void decl() #void : {}
  {
    (
      var_decl() | const_decl()
     )
  }
  
  void var_decl() #void : {}
  {
    &lt;VAR&gt; ident_list() &lt;COLON&gt; type()
   (&lt;COMMA&gt; ident_list() &lt;COLON&gt; type())* &lt;SEMIC&gt;
  }
  
  void const_decl()  #void : {}
  {
    &lt;CONSTANT&gt; identifier() &lt;COLON&gt; type() &lt;EQUAL&gt; expression()
   ( &lt;COMMA&gt; identifier() &lt;COLON&gt; type() &lt;EQUAL &gt; expression())* &lt;SEMIC&gt;
  } 
  
  void function() #void : {}
  {
    type() identifier() &lt;LBR&gt; param_list() &lt;RBR&gt;
    &lt;CBL&gt;
    (decl())*
    (statement() &lt;SEMIC&gt; )*
    returnRule() (expression() | {} )&lt;SEMIC&gt;
    &lt;CBR&gt;
  }
  </code></pre>