Java Reference
In-Depth Information
context-free grammars and parsers, recursion, and patterns. It is fun to use all of
these in a real program.
3. You learn about the language you are compiling (in our case, Java).
4. You learn a lot about the target machine (in our case, both the Java Virtual Machine
and the MIPS computer).
5. Compilers are still being written for new languages and targeted to new computer
architectures. Yes, there are still compiler-writing jobs out there.
6. Compilers are finding their way into all sorts of applications, including games, phones,
and entertainment devices.
7. XML. Programs that process XML use compiler technology.
8. There is a mix of theory and practice, and each is relevant to the other.
9. The organization of a compiler is such that it can be written in stages, and each stage
makes use of earlier stages. So, compiler writing is a case study in software engineering.
10. Compilers are programs. And writing programs is fun.
1.3 How Does a Compiler Work? The Phases of Compilation
A compiler is usually broken down into several phases|components, each of which performs
a specific sub-task of compilation. At the very least, a compiler can be broken into a front
end and a back end (Figure 1.3).
FIGURE 1.3 A compiler: Analysis and synthesis.
The front end takes as input, a high-level language program, and produces as output
a representation (another translation) of that program in some intermediate language that
lies somewhere between the source language and the target language. We call this the
intermediate representation (IR). The back end then takes this intermediate representation
of the program as input, and produces the target machine language program.
1.3.1 Front End
A compiler's front end
Is that part of the compiler that analyzes the input program for determining its
meaning, and so
Is source language dependent (and target machine, or target language independent);
moreover, it
 
Search WWH ::




Custom Search