Translators Flashcards
(14 cards)
What is the purpose of a translator?
Changes a program written in one language into another language (usually machine code)
What are the 2 main types of translators?
Interpreter and compiler
How does an interpreter work?
Converts high-level language one line at a time into machine code and executes it
How does a compiler work?
Converts high-level language into machine code for execution at a later time; the entire program is converted at once
Describe the execution method of an interpreter
Translates source code into machine code one line at a time
Describe the execution speed of an interpreter
Slower than a compiler: code must be reinterpreted each time the program is run
Describe the complexity of an interpreter
Smaller, simpler programs
Describe the error reporting of an interpreter
Interpreter encounters errors and reports it to the user immediately and stops the program from running
Describe the repetition of an interpreter
Interpreted programs can be edited and run without translating the whole program; interpreters must reinterpret the program every time it is run
Describe the execution method of a compiler
Translates all the source code into machine code in one go: it produces an executable file that will run on other machines without the compiler needing to be installed
Describe the execution speed of a compiler
Can produce much more efficient code than interpreters: compiled programs run faster
Describe the complexity of compilers
Large, complex programs
Describe the error reporting of a compiler
It would analyse the entire program, taking note of where the errors have occurred and record them in an error file
Describe the repetition of a compiler
Requires analysis and the generation of the code only once, however compiled programs must be re-compiled after any changes have been made