1.1: Overview of Compilers
A compiler is a complex software system, and, as such, has a system life cycle that starts with a need, transitions to design and construction/implementation, undergoes testing, transitions to use in its intended environment, undergoes maintenance over its life, and ends with "disposal" and archival storage. The activities, various work products, and documentation that comprise the processes used during the system's life must be carefully planned. The part of the system life cycle that deals with the design and construction of the compiler is called the development life cycle. This course focuses on the development life cycle, but the overall system life cycle must be kept in mind.
The term "compiler process" is related to, but different from the system (life cycle) process. The "compiler process" refers to the processing that a compiler does when it performs its function of translation of a source program to a target program. It also refers to the approach taken to design a compiler. Design, in fact, is one activity in the system (life cycle) process.
1.1.1: Compiler Definitions, Terminology, and Anatomy of a Compiler
For a definition of a compiler and some terminology, study slides 13-26. For an anatomy of a compiler see slides 27-47. For examples of optimization see slides 48-76. These slides have good examples of compiler output for a given input and a lot of examples of optimizations. A compiler translates a high-level language to a low-level language.
For a slightly different overview of compilers, study slides 8-47. These slides make an analogy between compilation and the equivalence-preserving transformations of an electrical circuit.
Read the short paragraph on Related Techniques, which defines related terms: language translator, assembler, disassembler, and decompiler.
1.1.2: History
Read the interesting history of the early compilers and computer pioneers, such as Grace Hopper, who worked on the first COBOL compiler.
Read sections 1.1, 1.2, and 1.3. Note that "compile" means to translate from a high-level language, used by humans, to a low-level language used by a computer. A high-level language uses concepts, objects, and tasks performed by a human, whereas a low-level or machine language uses concepts, objects, and tasks performed by machines.
The input language to a compiler, typically a programming language, is called the source language. The output language of a compiler is called the target language or object code, typically an assembly language or machine language.
The author describes seven phases of a compiler. The middle phase is called Intermediate Code Generation. The intermediate code is independent of a particular target machine. One of the back-end phases is called Machine Code Generation, which translates the machine-independent code to machine-dependent code for a particular computer.
The need for compilers arises from the need for high-level languages, which are more relevant for problem solving and software development by humans. Moreover, high-level languages are machine independent.
1.1.3: Other Applications
Read section 1.4, which gives reasons for studying compilers. In the discussion, the author suggests other applications for compiler techniques and tools. He specifically mentions domain-specific languages. Other applications derive from techniques and methods used in compilers. For example, if the input to a software system can be described using a formal grammar, then lexical- and syntax-phase techniques may be the most effective and efficient to use for inputting, verifying, and representing the data for processing. Front-end techniques can also be applied via software tools to the enforcement of development and programming standards and procedures. Knowledge of compiler techniques and methods helps in the design of new programming languages, new hardware architectures, generation of software applications, and the design of software tools.
1.1.4: Hardware Compilation
Read the short paragraph on Hardware Compilation. Note that hardware compilation refers to the translation of a software program to a hardware representation.