Lecture02 - Programming
Lecture02 - Programming
Source Program
Compiler
Source Program
Compiler
Source Program
Compiler
You translate once and run many times.
Interpreter
Output
Interpreter
You translate for each run.
Output
Source Source In
Interpreter
Compiler
Source Source In
Interpreter
Compiler
Source Source In
Interpreter
Compiler
Source Program
Translator
Intermediate
Program Virtual
Output
Machine
Input The University of North Carolina at Chapel Hill
Compilation and Interpretation
Translator
Intermediate
Program Virtual
Output
Machine
Input The University of North Carolina at Chapel Hill
Compilation and
The Interpretation
translator can be a compiler or an
interpreter. It is considered to be a compiler if:
1. There is a thorough analysis of the program
Source Program
2. The transformation is non-trivial.
Translator
Intermediate
Program Virtual
Output
Machine
Input The University of North Carolina at Chapel Hill
Compilation and Interpretation
Source Program
Intermediate
Program Virtual
Output
Machine
Input The University of North Carolina at Chapel Hill
Linking Source Program
Compiler
Machine
Library language
Linker program
Routines
Machine
Library language
Linker program
Routines
Compiler
Machine
Library language
Linker program
Routines
Source Program
Preprocessor
Source Program
For example, this may be used to remove
comments or use replacement macros.
Preprocessor
Source Program
program
•
, id(OUTPUT) more_ids Rest of code
•
, id(OUTPUT) more_ids Rest of code
The parse
gcd tree
program ( is sometimes
input , output called
) ; a
concrete syntax tree because it contains
how all tokens are derived...
program
•
, id(OUTPUT) more_ids Rest of code
•
, id(OUTPUT) more_ids Rest of code
program