Chapter 10 - Programming language translators Flashcards
What type of code is needed for the CPU to understand it and execute the instructions?
» Machine code
What is the relationship between assembly code and a binary code instruction?
» One - to -one
What does the machine code instructions that a particular computer can execute depend on?
» The instruction set
What is the processor instruction set?
» Manufacturer defines a set of these instructions that processor will be able to carry out that will only work with that particular processor
» Each type of processor will have a different instruction set and different assembly code
What are 2 features of low level language?
» Specific to the instruction set of the processor
» Non-portable (Meaning it can only be run on a processor of the same type that it was written for)
What is an advantage of using low level languages?
» Can make use of specific registers
» Therfore programmers have greater control over the movement of data in and out of the processor
Why are low-level languages not portable?
» As the machine code and assembly code are designed for that specific processor
» Therefore cannot be processed on other processors
What are 2 disadvantages of using low level languages?
» Difficult to write programs in low level languages as programmers need to have a very good understanding of the hardware being used
» Do not have libraries
What are the categories of low level language?
» Assembly code
» Machine code
What is the source code?
» Programming statements that are created by a programmer
What are 2 features of assembly code?
» Type of low-level-language, which is made up of commands/mnemonics
» Each code translates into 1 machine code instruction
What are the advantages of high-level languages?
» Much easier to write/read words
» Portable
» Come with libraries
How are assembly code instructions translated into machine code?
4 marks
» Done by an assembler
» Replaces mnemonic opcodes with machine code - LDA
» Replaces numeric operands with machine code - NUM2
» Chekcs syntax and runs error diagnostics if erros is found
What does the compiler do?
» Translates whole program written in a high level language into executable machine code
» Creates object code before being executed into machine code
How does a compiler work?
» Translates high-level code into machine all at once
» Carrying out a number of checks first
» Compiled code is non-portable
» Code can be run without a translater being present
What does an interpreter do?
» Translate code from high level language into machine code line by line