public class SL_IfNode extends ParseNode {
  // child 0: condition
  // child 1: 'then' block
  // child 2: 'else' block

  public int getType() { return G_IF; }
  public ParseNode interpret(SymbolTable st) 
    throws InterpretException, ReturnException, BreakException {
      SL_ExprNode condNode=(SL_ExprNode) getChild(0);
      SL_BlockNode child1=(SL_BlockNode) getChild(1);
      SL_BlockNode child2=(SL_BlockNode) (numChildren()==2? null:getChild(2));
      SL_NumberNode condition = (SL_NumberNode) condNode.interpret(st);
      if (condition.getValue().intValue()!=0) return child1.interpret(st);
      else return (child2==null)? null : child2.interpret(st);
  }
}
