Compiled vs Interpreted Languages -- Revision Notes
Compiled Language
• Definition: Entire source code is fully translated into machine code before execution.
• When translation happens: One-time before execution.
• Execution: CPU directly executes machine code.
• Speed: Very fast at runtime.
• Debugging: Slower (needs recompilation after code changes).
• Examples: C, C++, Rust, Go
Interpreted Language
• Definition: Code is read and translated line-by-line while running.
• When translation happens: Every time during execution.
• Execution: Interpreter (already compiled) translates the code at runtime and passes instructions to
OS/hardware.
• Speed: Slower due to real-time translation.
• Debugging: Easier (quick feedback after changes).
• Examples: Python, JavaScript, Ruby, PHP, Perl, Tcl
Key Technical Point
• CPU always executes machine code.
• The difference is when and how high-level code is translated into machine code.
Visual Flow
Compiled Language:
Source Code → Compiler → Machine Code → CPU
Interpreted Language:
Source Code → Interpreter → OS/System Calls → CPU
1
Special Notes
• Perl and Tcl are traditionally interpreted languages.
• They follow the same real-time translation model.
• Some implementations may have partial pre-compilation (bytecode), but in general, they belong to
interpreted category.
Golden Rule
"Translation always happens. The only question is: before running or during running?"