
54 An Introduction to Compiler Construction in a Java World
We re-number the states to produce the equivalent DFA shown in Figure 2.24.
FIGURE 2.24 A minimal DFA recognizing (a|b)∗baa.
2.9 JavaCC: Tool for Generating Scanners
JavaCC (the CC stands for compiler-compiler) is a tool for generating lexical analyzers
from regular expressions, and parsers from context-free grammars. In this section we are
interested in the former; we visit the latter in the next chapter.
A lexical grammar specification takes the form of a set of regular expressions and a set of
lexical states; from any particular state, only certain regular expressions may be matched in
scanning ...