Programming Languages and Translators
Language classification
High-level languages (HLL)
- Problem-oriented languages designed to be easily read, written, and maintained by humans.
- Use English-like statements (e.g. IF FirstNumber > SecondNumber THEN).
- Architecture-independent and portable; the same source code can run on entirely different CPU hardware platforms with minimal changes.
- Example of HLL include:
- Python
- C++
- Java
Low-level languages (LLL)
- Hardware-oriented languages tied to specific processor instruction set architectures.
- Machine code is the raw binary (0s and 1s) or hexadecimal representations that the CPU reads and executes directly. It is exceptionally difficult for humans to comprehend or debug.
- Assumbly language is a low-level language that replaces binary code with short, memorable abbreviations called mnemonics. It requires an Assembler translator program to convert it back into machine code.
- LDA means to load the value of a specific variable into the CPU’s accumulator register.
- ADD means to add the numerical value of a variable to the current value in the accumulator.
- STO means to store or replace the value in the accumulator back into a specific variable’s memory address.
HLL vs. LLL comparison
| Language level | Advantages | Disadvantages |
|---|---|---|
| HLL | Easier and faster to read, write, and develop. Simpler to debug during development stages. Highly portable across different machine configurations. | Programs require translation before execution. Compiled object code takes up more memory space. Slower execution speed compared to optimized low-level code. |
| LLL | Can utilize and optimize specialized hardware configurations. Code takes up very little memory space. Code executes incredibly fast. | Machine dependent (not portable, code must be completely written if different CPU type). Takes significantly longer to write, read, and understand. Highly complex to debug and maintain. |
Software translators (compilers, interpreters and assemblers)
- Computers can only understand raw binary machine code. Any software written in an HLL or Assembly language must be processed by a translator program.
| Feature | Compiler | Interpreter | Assembler |
|---|---|---|---|
| Input source code | HLL | HLL | Assembly Language (using Mnemonics) |
| Translation method | Translates entire source program in one single operation. | Translates and executs the program code line-by-line. | Translates assembly mnemonics directly into binary machine instructions. |
| Output produced | Generates a standalone, machine-ready file called Object Code (.exe). | Does not produce an independent object code file. | Generates an independent machine code file. |
| Execution speed | Very fast execution since translation is completed beforehand. | Slower execution because translation occurs continuously during runtime. | Very fast execution of translated instructions. |
| Error diagnostics | Products a comprehensive error log report at the very end of compilation. | Halts execution the exact instant a line containing a syntax error is reached. | Produces a listing of assembly translation errors. |
| Distribution/deployment | Finalized object code can be shared; original source code remains hidden. | Original source code must be distributed, and the end-user most possess an interpreter. | The translated machine code can be distributed directly to matching hardware systems. |