title: Grammar for java like switch case function using ANTLR
body: <p>I would like to implement java like switch-case functionality using ANTLR.</p>
  
  <p>Following is the grammar I defined:</p>
  
  <pre><code>switchFunction
  : "switch"^ LPAREN ! expression RPAREN ! LCURLY ! ( caseFuntion )* RCURLY !
  ;
  
  caseFunction
  : ("case"^ expression | "default") COLON!
  ;
  </code></pre>
  
  <p>But when I give the following example language, I am getting error saying RCURLY is expected but found print</p>
  
  <pre><code>switch(fruit)
  {
    case 'Apple': print "apple";
  }
  </code></pre>
  
  <p>Can someone help me with the grammar for switch case</p>
  
  <p>Thanks.</p>