package Tree;

/**
 * A call to a built-in operation.  
 *
 * @author Samuel A. Rebelsky
 * @version 1.0 of December 1998
 */
public class BUILTIN extends Exp {
  // +--------+--------------------------------------------------
  // | Fields |
  // +--------+

  /**
   * The name of the function.  While this is given as an Exp,
   * it should only be a LABEL.  
   */
  public Exp func;

  /**
   * The arguments to the function.
   */
  public ExpList args;


  // +--------------+--------------------------------------------
  // | Constructors |
  // +--------------+

  /** 
   * Build a new call to a built-in operation.
   */
  public BUILTIN(Exp func, ExpList args) {
    this.func=func; 
    this.args=args;
  } // BUILTIN(Exp,ExpList)


  // +---------+-------------------------------------------------
  // | Methods |
  // +---------+

  /**
   * Get all of the subexpressions.
   */
  public ExpList kids() {
    return new ExpList(func,args);
  } // kids()

  /**
   * Build a new call using function and subexpressions.
   */
  public Exp build(ExpList kids) {
    return new CALL(kids.head,kids.tail);
  }
  
} // class BUILTIN

