High-Level Language
- Definition: Programming languages that are closer to human language and abstract away hardware details.
- Examples: Python, Java, C++, JavaScript.
- Key Features:
- Easy to read, write, and debug.
- Portable across different machines (platform-independent).
- Needs a compiler or interpreter to translate into machine code.
Low-Level Language
- Definition: Programming languages that are closer to machine language and directly interact with hardware.
- Examples: Assembly language, Machine language.
- Key Features:
- Faster and more efficient.
- Harder to read and write compared to high-level languages.
- Requires assembler to translate into machine code.
Compiler
- Definition: A tool that translates high-level language code into machine code (binary form) that the computer can execute.
- How it Works:
- Takes the entire source code as input.
- Converts it into machine code or an intermediate file (e.g.,
.exe
). - Reports all errors at once.
- Examples: GCC (C Compiler), Java Compiler (Javac).
Assembler
- Definition: A tool that converts assembly language code into machine code.
- How it Works:
- Reads the assembly instructions (e.g.,
MOV
,ADD
). - Converts them to binary instructions (machine code).
- Reads the assembly instructions (e.g.,
- Example: MASM (Microsoft Assembler).
Linker
- Definition: A tool that combines multiple object files (produced by the compiler/assembler) into a single executable file.
- Key Functions:
- Links external libraries or functions.
- Resolves symbol references (e.g., calls to functions in other files).
- Output: Produces the final executable program.
Loader
- Definition: A part of the operating system that loads the executable file into memory for execution.
- How it Works:
- Takes the executable file created by the linker.
- Allocates memory for the program.
- Transfers control to the program so it can start running.
Summary Table
Term | Purpose | Example Tools |
---|---|---|
High-Level Language | Easy programming for humans; requires translation to machine code. | Python, Java, C++ |
Low-Level Language | Direct hardware interaction; harder to write but very efficient. | Assembly, Machine Code |
Compiler | Translates high-level language to machine code. | GCC, Javac |
Assembler | Converts assembly code to machine code. | MASM |
Linker | Combines object files and libraries into a single executable file. | GNU Linker, MSVC Linker |
Loader | Loads the executable file into memory and starts its execution. | Part of the operating system |
Example Flow:
- Write code in a high-level language (e.g., C).
- Use a compiler to convert it into object files.
- Use a linker to combine object files into an executable.
- The loader loads the executable into memory and starts it.
This process enables high-level code to run on a computer!