Added type() function and cast functions. Changed compiler interface to
prepare for compilation of user-defined code.