Java Reference
In-Depth Information
10
Intermediate
Representations
Compilers translate programs from their source form into a representation
that is suitable for interpretation or execution. The chapters of this topic have
thus far considered the scanning, parsing, and semantic analysis of programs
written in source languages such as Java TM and C
.The abstract syntax
tree (AST) was introduced in Chapter 7 to represent the source program in
a form that omits unnecessary syntactic detail. Semantic information was
developed in Chapters 8 and 9 to prepare the AST for code generation. The
next and final step of a simple compiler is code generation. Code generation
for a virtual machine is considered in Chapter 11. Chapters 12 and 13 consider
runtime support and code-generation techniques for low-level targets.
Preparation for generating code for a given architecture should include
gaining some familiarity with the architecture. Such studies may include
reading a specification of the code that will be generated, examining code se-
quences from other compilers, and writing some sample sequences by hand.
In this chapter, we examine a form of code known as an intermediate repre-
sentation (IR). Where such representations are su
++
ciently formalized, docu-
mented, and widely used, they are often merit designation as intermediate
languages (ILs).
Intermediate representations and languages are typicallymore concise and
abstract than lower-level target languages. We therefore study intermediate
391
 
 
Search WWH ::




Custom Search