Theory
Three tools, one confusion
Your marks program exists on paper. Now the practical questions: where do you type it? What turns it into the machine code the CPU wants? And why does your Python-learning friend say she "never compiles anything"?
Three tools answer these: editor, compiler, interpreter. Students blur them into one "the software where you do coding", and examiners feast on that blur every single year.
Theory
Notebook, book translator, live interpreter
The editor is a notebook: it holds what you write, judges nothing, translates nothing. A compiler is a book translator: takes your complete manuscript, translates the whole thing, hands back a finished book others can read at full speed. An interpreter is the live interpreter beside a speaker: translating sentence by sentence, instantly, but present at every single conversation, so it is slower overall.
At a glance
The three tools side by side
| Tool | Job | Examples |
|---|---|---|
| Editor | Write and edit source text | Notepad, VS Code, Turbo C editor |
| Compiler | Translate the whole program, then run | C, C++ toolchains |
| Interpreter | Translate and run line by line | Python, old BASIC |
Theory
Compiler vs interpreter: the exam comparison
- When translation happens: compiler translates everything before the program runs; interpreter translates during the run, line by line.
- Error style: the compiler checks the whole file and reports all errors together; the interpreter runs until it hits the first error line, then stops there.
- Speed: compiled programs run faster (translation cost already paid); interpreted lines pay translation cost on every run.
- C is compiled. That is why the pipeline from last lesson exists: .c → .obj → .exe.
Quiz
Your C program has errors on lines 5 and 12. Your friend's Python program has errors on the same lines. Who learns about BOTH errors first?
- You: the compiler checks the whole file and lists both errors together
- Your friend: interpreters are faster at finding errors
- Both see both errors at the same time
- Neither: errors only appear while the program runs
Show the answer
You: the compiler checks the whole file and lists both errors together
The compiler reads the entire source before anything runs, so its error report covers the whole file, lines 5 and 12 together. The interpreter executes line by line and stops dead at line 5; line 12's error stays hidden until line 5 is fixed and the program is re-run. This exact scenario is the classic compiler-vs-interpreter exam question.
Think first
Think it through
A weather app does heavy calculations millions of times per second. Reason from the analogy: compiled or interpreted, which suits it, and why?
Show the answer
Compiled. The translation was done once, in advance, so at run time the CPU eats pure machine code at full speed. An interpreter would re-translate the same hot lines millions of times, paying the translator on every pass. General rule worth quoting: compile for speed, interpret for convenience, which is also roughly why system software leans on C and quick scripts lean on Python.
Watch out
Where marks leak
Writing that the editor translates or runs code: it is a text tool, full stop. Saying the interpreter is "faster": it FEELS immediate (no compile step) but executes slower; keep the two speeds separate. And when you use Turbo C or VS Code, you are inside an IDE: editor + compiler + runner bundled in one window, three tools, one roof, still three tools in the exam answer.
Theory
Set up your own kitchen
This week, install one C setup and compile the marks program from last lesson: any online C compiler works to start, and a local IDE (Code::Blocks, VS Code + GCC) earns you real practice. Watching YOUR OWN .c file become an .exe cements two lessons at once. Next up: the exact anatomy of that little program, line by line.
Summary
Key takeaways
- Editor: writes source text; translates nothing (Notepad, VS Code).
- Compiler: whole program translated before running; all errors reported together; C's way.
- Interpreter: line-by-line translate-and-run; stops at first error; Python's way.
- Compiled programs execute faster; interpreted ones give quicker feedback.
- An IDE bundles editor + compiler + tools in one window.
- Memory hook: notebook, book translator, live interpreter.