| Refresh | Home EGTry.com

java codes generated from grammar rules



simple repetition

rule

void prog():
{
}
{
   (<ID>)*
  <EOF>
}


generated java method

  final public void prog() throws ParseException {
    label_1:
    while (true) {
      //get the next token type
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case ID:
        ;
        break;
      default: //no more match for this item
        jj_la1[0] = jj_gen;
        break label_1;
      }
      jj_consume_token(ID); //get the next token
    }
    jj_consume_token(0); //EOF
  }