The lexical analyzer is the first phase of compiler.Its main task is to tokenize the input source code and provide these tokens to the parser on request for syntax analysis.