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(); }
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(); }
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); }