Beginner Topic 1 of 50 Languages & Compilers
Compiled vs Interpreted Languages
Translating ahead of time versus executing line by line.
How it works
A compiler translates a whole program into machine code, or another low-level form, before it runs, producing an executable that the processor runs directly. An interpreter reads and executes source or an intermediate form step by step at run time. Compiled languages such as C, C++ and Rust usually run faster and can optimize globally, while interpreted ones such as Python and Ruby offer quick edit-run cycles and flexibility. Many languages mix both with bytecode and just-in-time compilation.
Step-by-step walkthrough
- A compiler translates the whole program ahead of time.
- The result is a machine code file that runs directly and fast.
- An interpreter reads and executes the source while running.
- It starts instantly and is flexible, but is usually slower.
- Many languages mix both, using bytecode and a JIT.
Where it is used
Systems software, games and high-performance code are typically compiled, scripting, automation and rapid prototyping often use interpreters, and Java and C# run bytecode on virtual machines.
Common pitfall
Whether a language is compiled or interpreted is a property of its implementation, not the language itself: C has interpreters and Python has compilers. Assuming interpreted means slow ignores JIT compilers that are very fast. Compiled binaries are platform-specific, whereas interpreters need to be installed. Choose by performance, deployment and development speed needs.
Where it fits in the course
Compiled vs Interpreted Languages is topic 1 of 50 in Languages & Compilers, rated Beginner. It is the first topic in this area. The next topic is Syntax and Semantics.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Languages & Compilers quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Languages & Compilers quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Compiled vs Interpreted Languages?
Where do people use Compiled vs Interpreted Languages?
What is the most common mistake with Compiled vs Interpreted Languages?
What should I learn before this topic?
How can I practice it?
Is Compiled vs Interpreted Languages hard to learn?
How long does it take to learn Compiled vs Interpreted Languages?
Which topics are related to Compiled vs Interpreted Languages?
What should I study after Compiled vs Interpreted Languages?
Related topics
- Syntax and Semantics (Languages & Compilers)
- Programming Paradigms (Languages & Compilers)
- Static vs Dynamic Typing (Languages & Compilers)
- Strong vs Weak Typing (Languages & Compilers)
- Alphabets and Languages (Theory & Discrete Math)
- Regular Languages (Theory & Discrete Math)
- Pumping Lemma for Regular Languages (Theory & Discrete Math)