A Compiler is a program that translates source code written in a high-level programming language into machine code or bytecode.It processes the entire code at once, producing an executable file or another form of output. Compilers are commonly used in languages like C,C++,and Java
An Interpreter is a program that executes source code directly without the need for a separate compilation step. It processes code line by line,translating and executing each statement on-the-fly.Interpreters are often used in languages like Python, Javascript and Ruby offering flexibility ease of debugging during development
Compiler | Interpreter |
It translates entire source code into machine code or byte code | It translates each and every code line by line |
Compilers generate executable files | Interpreter executes code directly without generating an intermediate file |
Compiler detects errors after the entire code is compiled | Interpreter stops at the first encountered error |
They are comparitively Faster | They are slower |
They are less portable | They are portable |
What are High Level and Low Level Programming Languages?
High-Level Programming languages are designed to be easily readable and writable by humans.They are abstracted from the underlying hardware of the computer, offering constrcuts and commands that are closer to natural language and higher-level concepts
Low-Level programming languages, on the other hand are closer to the hardware and provide more direct control over the computer's resources.They often correspond more closely to the architecture of the computer's processor and memory.
Types of Memory
Primary Memory:
Random Access Memory(RAM): Volatile memory used for temporary storage during program execution.
Read Only Memory(ROM): Non-Volatile memory that stores firmware and instructions needed to boot up the system.
Secondary Memory:
Hard Disk Drive(HDD): Non-volatile storage used for long-term data storage.
Solid State Drive(SSD):Non-volatile storage similar to HDD but uses flash memory for faster data access
Optical Drives: Non-volatile storage using optical discs like CDs,DVDs, and Blu-ray discs.
Cache Memory:
L1, L2 and L3 Cache: Fast, small-sized memory units located close to the CPU for rapid access to frequently used data and instructions.It's the fastest memory
Virtual Memory:
Memory management technique that uses secondary storage (like HDD or SSD) as an extension of primary memory to compensate for physical RAM limitations.