Ch1 1 Slides Updated
Ch1 1 Slides Updated
Construction
2
Source Target
Compiler
Program Program
(cont’d)
• “ Interpretation”
– Performing the operations implied by the
source program
– Oversimplified view:
Source
Program
Interpreter Output
Input
Error messages
The Analysis-Synthesis Model of
4
Compilation
Analysis-Synthesis Model
• Editors (syntax highlighting)
• Pretty printers (e.g. Doxygen)
• Static checkers (e.g. Lint and Splint)
• Interpreters
• Text formatters (e.g. TeX and LaTeX)
• Silicon compilers (e.g. VHDL)
• Query interpreters/compilers (Databases)
Preprocessors, Compilers,
6
Preprocessor
Source Program
Try for example:
Compiler
gcc -v myprog.c
Target Assembly Program
Assembler
Relocatable Object Code
Linker Libraries and
Relocatable Object Files
Absolute Machine Code
The Phases of a Compiler 7
Compiler-Construction Tools
• Software development tools are available to
implement one or more compiler phases
– Scanner generators
– Parser generators
– Syntax-directed translation engines
– Automatic code generators
– Data-flow engines