Why use assembly code?
- To execute as fast as possible
- T o occupy as little space as possible
Assembly code is used for parts of an operating system, device drivers and programs in embedded systems.
Imperative High Level Language
High-level languages are independent of computer architecture and are written in English statements. One high levels language statement is translated into several machine code instructions. Imperative languages consist of a number of instructions in sequence, which the computer follows.
These include
Translators
All programs that are not written in machine code must be translated before they can be executed 3 types of translators include:
Assembler – An assembler is a program which translates an a assembly code program into machine code.
Compiler – A program, which translates a high level program (Source Code) into machine code (Object Code).
A compiler translates an entire program into machine code into object code, produces an error report and saves a copy of the object code. The object code can then be executed as often as required without the need for re-transmission.
Advantages:
- Executed Faster
- No need to re-compile
- Cannot be altered
- Suitable for distribution
Interpreter - A program, which translates a high level program (Source Code) into machine code (Object Code).
An interpreter translates one line of a high-level language program, checks if there are any errors in that line if error program translation stops, if no error that line the translated line are executed. The interpreter then moves to the next line and repeats this process this means that every time a program is to be executed it must also be translated.
Advantage:
- For program development
- It’s easier to partially test and debug programs