The phases of a compiler are: 1. Lexical analysis breaks the source code into tokens 2. Syntax analysis checks the token order and builds a parse tree 3. Semantic analysis checks for type errors and builds symbol tables 4. Code generation converts the parse tree into target code