Lexical Analysis
摘要
This chapter describes the first phase of a compiler, namely lexical analysis (scanning). It shows how a source program is transformed into a token stream that is then passed on to the next compiler phase (syntax analysis). Using regular grammars to specify the structure of the lexical symbols, it explains how a scanner works as an automaton that transforms a character stream into a token stream. It finally shows how to write a scanner for MicroJava.