
A compiler translates a program into another form before that form runs; an interpreter performs the program through another running program. In the familiar simplified case, a compiler produces native machine code or an executable, while an interpreter reads source or bytecode and carries out its instructions. The real distinction is the implementation strategy, not a permanent label attached to a programming language.
This comparison is for students learning programming, computer architecture, or language runtimes. The useful questions are: when does translation happen, what artifact is produced, what program executes next, and when can an error become visible? Those questions explain more than the slogan “compiler equals whole program, interpreter equals one line at a time.”
A compiler accepts a program in one language and emits an equivalent program in another representation. That target might be assembly, native machine code, WebAssembly, or virtual-machine bytecode. The GNU Compiler Collection documentation describes a C build as potentially moving through preprocessing, compilation, assembly, and linking; a successful build can leave an executable that runs without rereading the original C source.
An interpreter remains involved while the program is being performed. It may walk a syntax tree, execute bytecode instructions, or translate selected operations as execution continues. The key point is not literal line-by-line reading. Many interpreters parse an entire file first, and many compile source to an intermediate form before executing it.
The strategy changes the development loop and distribution model. Ahead-of-time compilation adds a build step, but the resulting native program can start without translating the original source again. Interpretation supports interactive sessions and can make one program representation portable wherever a compatible runtime exists. Portability still has conditions: native executables target particular platforms, while bytecode depends on the availability and behavior of its virtual machine.
Performance is not settled by the label alone. A compiler can spend time optimizing before execution. An interpreter can begin work quickly, and a just-in-time compiler can observe a running program and compile frequently used sections to native code. Startup time, peak speed, memory, predictability, and implementation quality all matter, so “compiled is always faster” is too broad to be a rule.
Imagine a tiny C program whose middle statement contains an incomplete expression: return 2 + ;. A C compiler diagnoses the syntax problem during the build. Because the build fails, it does not produce the intended executable. Fix the statement, compile again, and only then run the new program. This makes build errors feel separate from runtime errors.
Now imagine a three-line Python file: print start, then an incomplete print expression, then print end. CPython parses the file before executing its body, so the syntax error can prevent even the first print from running. That is why “an interpreter executes one line and then reads the next” is a misleading mental model. The Python tutorial calls Python an interpreter, but the implementation still performs parsing and compilation work.
Change the middle Python line from invalid syntax to a valid expression that divides by zero. Now the file can parse, the first line may print, and execution stops at the runtime exception before the third line. Syntax timing and runtime timing are different dimensions. A compiler can also produce a program that later fails at runtime; successful translation does not prove successful execution.

C is commonly compiled ahead of time to native machine code. That makes it a good example of the build-first path, but the language itself does not magically require one toolchain design. A C interpreter can exist, and a compiler can target something other than a native executable.
Python is commonly called interpreted because users run programs through a Python implementation. In CPython, source is compiled to bytecode and that bytecode is executed by the Python virtual machine. The bytecode step is still compilation; it simply does not usually produce a standalone native executable. Cornell's computer science notes use bytecode interpreters to show why compilation and interpretation often appear in the same system.
Java makes the mixture especially visible. The javac compiler translates Java source into class files containing Java Virtual Machine bytecode. A JVM can interpret that bytecode and can also just-in-time compile selected methods to native instructions. The Java Virtual Machine Specification deliberately leaves room for implementations and notes that the JVM does not assume one particular host technology. Princeton's introductory computer science material presents Java as a combination of compiler and interpreter.

Instead of asking whether a language is compiled or interpreted, trace the pipeline. Start with source code. Identify every intermediate representation, including assembly or bytecode. Then name the component that executes the final representation: the processor, an interpreter, a virtual machine, or generated native code. Finally, ask whether translation happens ahead of time, just in time, or in both places.
This method also helps when tools hide stages. A command named python can parse, compile, cache, and interpret. A command named java can load bytecode, verify it, interpret some instructions, and compile hot methods. If your lecture notes reduce all of that to two boxes, Snitchnotes can help turn the notes, slides, and PDFs into a comparison sheet, flashcards, or a quiz built around the actual pipeline.
First, an interpreter does not have to process raw source one line at a time. Second, compilation does not guarantee a standalone executable; its output may be bytecode or another intermediate representation. Third, errors are not divided into “compiler errors” and “interpreter errors.” Syntax, type, linking, loading, and runtime failures can surface at different stages depending on the language and implementation.
Finally, a language specification and a language implementation are different things. C, Python, and Java name languages, while GCC, CPython, and a particular JVM are implementations or toolchains. Classify the concrete implementation you are using, and state the stage you mean. That small habit prevents most compiler-versus-interpreter arguments from becoming word games.
Because an interpreter may parse the whole source, compile it to bytecode, and then execute that representation. A syntax error later in a file can therefore stop execution before the first statement runs.
No. A compiler translates from one representation to another. The target can be native code, assembly, bytecode, WebAssembly, or another intermediate form.
Java source is compiled to JVM bytecode. A JVM can interpret that bytecode and just-in-time compile selected methods to native code, so the runtime combines strategies.
GNU Compiler Collection: Overall Options and compilation stages
Python documentation: Using the Python Interpreter
Oracle: The Java Virtual Machine Specification, Java SE 25 Edition
Cornell University CS 2112: Interpreters, Compilers, and the Java Virtual Machine
Princeton University Computer Science: Compilers, Interpreters, and Emulators
Notes, quiz, podcasts, flashcards et chat — en un seul upload.
Essaie ta première note gratuitement