Checking it makes sense, then translating
After the grammar checks out, the compiler asks 'does it mean anything?' — are the types and names valid? Only then does it translate the tree into machine code the CPU runs.
Analyze, then generate
Semantic analysis checks types and scopes; code generation then emits target instructions, often after optimization.