To check whether a character it's alphanumeric, use isalnum(). Also, I'm not sure if we need to check this somewhere else, too, but in any case I think the logic for checking whether it's a valid constant name should by in space.set_const. Finally, please don't duplicate the error raising code + string