Computer Systems - Programming Languages Flashcards
What are the types of translators to translate source code to machine code?
Compiler
Interpreter
How does an interpreter work?
It reads the code, interpreting it one line at a time into machine code.
If there is a syntax error the program will stop running and an error will be shown.
What are the advantages of an interpreter?
If there is a syntax error the program will stop running and an error will be shown, making debugging easier.
What are the disadvantages of an interpreter?
Slower
How does a compiler work?
It translates the source code into machine code in one go, before executing the program.
What are the advantages of a compiler?
Produces ready-to-use executable machine code
What are the disadvantages of a compiler?
Any changes to the code require it to be converted again.
Any errors will generally crash the program
What is the byte code?
It is created and compiled as an intermediate step between the source and machine code.
It allows for programs to be interpreted as and when they are needed.
It is interpreted according to the architecture of the machine the program is run on.
What are opcodes?
Commands, eg. LDA, ADD
What are operands?
The values, eg. A, 14
What is pseudo code?
Instructions written as a logical sequence of steps
What is assembly language?
A system of opcodes and operands based on binary codes.
The opcodes are assigned 3 letter mnemonics and the operands are the decimal or hexadecimal values
What is an assembler?
Translates assembly code into machine code.
What is a high-level language?
A computer language that is closer to a real language than to machine code
What are the advantages of a high-level language?
Easy to learn
Faster to read and write
Easier to understand, debug and maintain