signature IntStackSig =
  sig
    type intstack
    exception IntStackEmpty

    val emptyStack : intstack
    val push : intstack * int -> intstack
    val pop : intstack -> int * intstack
  end

structure IntStack : IntStackSig =
  struct
    type intstack = int list
    exception IntStackEmpty
    val emptyStack = []
    fun push (stk, itm) = itm::stk
    fun pop [] = raise IntStackEmpty
      | pop (itm::stk) = (itm,stk)
  end