What is lexical analysis?
Lexical Analysis is the initial phase of a compiler that involves scanning the source code and converting it into a sequence of tokens. This phase simplifies the parsing process, focuses on meaningful elements, and helps in detecting lexical errors. The lexical analyzer (lexer) performs the task of recognizing tokens and producing a token stream for further processing by the compiler.