Exam Flashcards
1
Q
What is a compiler?
A
- A computer program translates one language to another (Source Program to Target Program).
- A compiler is a complex program From 10,000 to 1,000,000 lines of codes.
- Compilers are used in many forms of computing (Command interpreters, interface programs).
2
Q
Why Compiler ?
A
Writing machine language-numeric codes is time consuming and tedious.
3
Q
What are the defects of assembly language ?
A
– Not easy to write.
– Difficult to read and understand.
4
Q
What is an Interpreter ?
A
- Execute the source program immediately rather than generating object code.
- Speed of execution is slower than compiled code by a factor of 10 or more.
- Share many of their operations with compilers.
5
Q
What are some examples of interpreters ?
A
BASIC, LISP, used often in educational or development situations.
6
Q
What is an Assemblers ?
A
- A translator for the assembly language of a particular computer.
- Assembly language is a symbolic form of one machine language.
- A compiler may generate assembly language as its target language and an assembler finished the translation into object code.
7
Q
What is a Linker ?
A
- Collect separate object files into a directly executable file.
- Connect an object program to the code for standard library functions and to resource supplied by OS.
- Becoming one of the principle activities of a compiler, depends on OS and processor.
8
Q
What is a Loader ?
A
- Resolve all re-locatable address relative to a given base.
- Make executable code more flexible.
- Often as part of the operating environment, rarely as an actual separate program.
9
Q
What is a Preprocessor ?
A
- Delete comments, include other files, and perform macro substitutions.
- Required by a language (as in C) or can be later add-ons that provide additional facilities.
10
Q
What is an Editor ?
A
- Compiler have been bundled together with editor and other programs into an interactive development environment (IDE).
- Oriented toward the format or structure of the programming language, called structure based.
- May include some operations of a compiler, informing some errors.
11
Q
What is a debugger ?
A
- Used to determine execution error in a compiled program.
- Keep tracks of most or all of the source code information.
- Halt execution at pre-specified locations called breakpoints.
- Must be supplied with appropriate symbolic information by the compiler.
12
Q
What is a profile ?
A
- Collect statistics on the behavior of an object program during execution.
– Called Times for each procedures.
– Percentage of execution time Used to improve the execution speed of the program.
13
Q
What are the six phases of a compiler ?
A
– Scanner. – Parser. – Semantic Analyzer. – Source code optimizer. – Code generator. – Target Code Optimizer.
14
Q
What are the three auxiliary components of a compiler ?
A
– Literal table.
– Symbol table.
– Error Handler.
15
Q
What does a scanner do ?
A
- Lexical analysis: it collects sequences of characters into meaningful units called tokens.
- Other operations: it may enter literals into the literal table.