16.2 - Translation Software Flashcards
(9 cards)
1
Q
How can an interpreter execute the program without producing s complete translated version
A
- An interpreter examines source code one statement at a time
- Check each statement for errors
- If no errors are found, statement is executed
- If an error is found, this is reported and the interpreter halts
- Interpratation is repeated for every section of code
- Repeats every time the program runs
2
Q
Why would you debug with interpreter
A
- Debugging is faster
- Can debug incomplete code
- Better diagnostics
3
Q
What happens in lexical analysis
A
- All uneccessary characters are removed, such as white spaces and comments
- Tokenization, uses a keyword table to convert sections of source code into tokens
- Variable, constants and identifiers are converted to locations.addresses
4
Q
Explains what happens in syntax analysis
A
- Outputs from lexical analysis is checked for syntax errors
- Construction of parse tree
- Production of error report
5
Q
Explain what happens in code generation
A
- Produces object program to preform the task defined in the source code
- Object program is in machine-readable form
6
Q
What happens in code optimization
A
- Preforming the task using minimum amount of resources
7
Q
Why is code optimized
A
- Redundant code removed
- Program requires less memory
- Program will complete task in shorter time
8
Q
Why can reverse polish notation be used to evaluate expression
A
- Provides clear method of representing an expression
- Reading from left to right
- WIthout the need to use brackets
- No need for rules for precedence
9
Q
Describe the main steps in evaluation of reverse polish notation using a stack
A
- Working expression from left ro right
- If element is a number, it is pushed onto a stack
- If element is an operator, pop the first 2 numbers on the stack
- Preforms the operation on these 2 numbers
- Push result back onto the stack
- End once the last expression has been delt with