Chapter 2: Introduction to compilers

Front End Phases

 

Lexical analysis is based on the finite state automata and hence finds the lexicons from the input on the basis of corresponding regular expressions. If there is some input which it can't recognize then it generates error. In the above example, the delimiter is a blank space. See for yourself that the lexical analyzer recognizes identifiers, numbers, brackets etc.