Why Study Lexical Analysis

Lexical analysis is one of the simplest aspects of compilers

Almost never a problem in practice

Why do we need to study it?

Reason 1: It is also the first phase of a compiler

So we study it first.

Reason 2: 'Drunk under the lamppost' effect

lamppost = a metal post supporting an outdoor lamp (such as a streetlight)

Lamppost

What are you doing?

Where did you lose it?

Then why are you looking for it here and not there?

Lexical Analysis is under the Lamppost

The problem can be described using finite state machines

Automated lexical analysis techniques are easier to understand