Lexical Analysis
The first phase of compilation that breaks source code into tokens and removes whitespace and comments.
Before a parser can understand syntax, source code must be transformed into a stream of meaningful units—tokens. A lexical analyzer reads character by character, grouping them into words, numbers, and operators, filtering out whitespace and comments. Without it, the parser would need to handle millions of irrelevant characters.