lex-i-cal: of or relating to words or the vocabulary of a language as distinguished from its grammar and construction
To translate a program from one language into another, a compiler must first pull it apart and understand its structure and meaning, then put it together in a different way. The front end of the compiler performs analysis; the back end does synthesis.
The analysis is usually broken up into
Lexical analysis: breaking the input into individual words or “tokens”;
Syntax analysis: parsing the phrase structure of the program; and
Semantic analysis: calculating the program’s meaning.
The lexical analyzer takes a stream of characters and produces a stream of names, keywords, and punctuation marks; ...