Move misc_lib to libutils

Also, move ProgrammingError from alloc to misc_lib