Moved much of the code for early compilation phases to lex.c