Translators: Interpreters, Compilers & Assemblers Flashcards
What is a translator?
Any program that converts the source code into machine code.
What do assemblers do?
Convert low-level assembly language directly into machine code. Each line of assembly code is looked up by the assembler and directly translated into one line of binary equivalent machine code.
What is the problem with assembler code?
Processor specific and not portable.
What do compilers & interpreters do?
Convert high level languages into object code or machine code.
What type of relationship to compilers & interpreters have?
One to many, each line of high level source code translates to many lines of binary equivalent machine code.
What do interpreters do?
Take one line of high level code and convert it directly into machine code and then run it.
What are the advantages and disadvantages of interpreters?
Useful for debugging since the program will start running immediately and stop at the first line which contains an error.
Requires access to whole source code each time it needs to be translates it. Security issue and code runs slowly.
What do compilers do?
Takes the entire program and converts into object code, this can take a while.
What are the advantages and disadvantages of compilers?
The object code can be distributed to anyone with a compatible system and the original source code is not needed on each machine.
Object code runs a lot faster than interpreted code.
If program updated then original source code needs to be changed and re compiled and distributed.