translators Flashcards
What are translators and how do they help?
Translators convert programming languages into machine code.
This helps as computers can only understand machine code for a program to be ran
Give three programs for conversion.
Assemblers
Compilers
Interpreters
What is the function of the assembler?
a program that converts low-level language programs into executable code
Why does the assembly language use mnemonics instead of machine or binary code?
Machine code or binary code is harder to us/ remember
each mnemonic written by programmer is replaced by corresponding binary machine code instruction by the assembler.
Give examples of mnemonic used.
INPUT= INP
OUTPUT= OUT
STORE= STA
LOAD= LDA
ADD= ADD
SUBTRACT= SUB
BRANCH= BRA
STOP= HLT
How does addressing give benefits to the coding of a programmer?
each location in a comp memory has an address
data is placed inside any of the addresses
and so we need to remember locations of data
using an assembler, a name can be given to a location which makes the program more readable and helps the programmer remember where items of data are stored
What is the function of the compiler?
translates a complete program of high level language (source code) into machine code
does this in one go without stopping
What can each high level instruction generate?
many low level ones
What two things does a compiler produce?
a program that can be run independently from the compiler
a list of errors at the end of the process
What are the two advantages of a compiler?
compiled program is faster than interpreted program (run speed)
checks all lines of code… interpreter only checks the ones executed
What is the function of the interpreter?
analyses source code line by line, converts it into machine code to be executed by CPU
Describe the interpreter
each high level instruction may generate several low level instructions
program can only run if interpreter is present
if error… the code is stopped and the interpreter shows the error
What are two advantages of an interpreter?
easier program development (errors can be corrected as the program is being interpreted)
individual lines of code can be modified at run time