Beispiel #1
0
 private void guarded_command() {
   System.out.print("(");
   expr();
   System.out.print(" <= 0");
   mustbe(TK.THEN);
   System.out.print(")");
   addBlock();
   System.out.println("{");
   block();
   System.out.println("}");
   removeBlock();
 }
Beispiel #2
0
  private void forl_statement() {
    System.out.print("for (");
    scan();

    System.out.print("int i = 0; i<=" + tok.string + "; i ++)");
    addBlock();
    System.out.print("{");

    scan();
    block();

    mustbe(TK.ENDFORL);

    System.out.println("}");
    removeBlock();
  }
Beispiel #3
0
 private void If_statement() {
   System.out.print("if");
   mustbe(TK.IF);
   guarded_command();
   while (is(TK.ELSEIF)) {
     System.out.print("else if");
     scan();
     guarded_command();
   }
   if (tok.kind == TK.ELSE) {
     System.out.print("else");
     scan();
     addBlock();
     System.out.println("{");
     block();
     System.out.println("}");
     removeBlock();
   }
   mustbe(TK.ENDIF);
 }