import java.math.*;

public class SL_LetNode extends ParseNode {
  // child 0: identifier
  // child 1: either an expr node or a call node, depending

  public int getType() { return G_LET; }
  public ParseNode interpret(SymbolTable st) throws InterpretException {
      String name = ((SL_IdentNode) getChild(0)).getName();
      SL_NumberNode value=null;
      try {
	value=(SL_NumberNode) getChild(1).interpret(st);
      }
      catch (BreakException b) { /* we know this can't happen, but javac doesn't */ }
      catch (ReturnException b) { /* we know this can't happen, but javac doesn't */ }
      if (value==null) throw new InterpretException("Can't set "+name+" to null");
      st.setBinding(name, value);
      return null;  
  }
}
