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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why would you debug with interpreter

A
  • Debugging is faster
  • Can debug incomplete code
  • Better diagnostics
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What happens in code optimization

A
  • Preforming the task using minimum amount of resources
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why is code optimized

A
  • Redundant code removed
  • Program requires less memory
  • Program will complete task in shorter time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly