/en-tutor-prep-alevel-computer-science-language-translators-ide/
/en-tutor-prep-alevel-computer-science-language-translators-ide/
General Inquiry: info@TutorZone.com.hk
Office Hours: Monday to Saturday - 9:00 AM to 6:00 PM
WhatsApp Monday to Sunday - 24 hours
Hotline: +852 6828 1809
Instant Support: +852 9061 3106

A-Level Computer Science — Language Translators and the IDE: compilers, interpreters and the four groups of development tools (lesson-prep guide for tutors)

A-Level Computer Science — Language Translators and the IDE: compilers, interpreters and the four groups of development tools (lesson-prep guide for tutors)

  • 2026-11-27

Students can say a compiler turns a program into machine code, then answer that an interpreter does no translation at all. This chapter pins the trade-off to one break-even point: 3.0 seconds of compiling then 0.5 seconds a run against 0.9 seconds interpreted, where compiling wins from run 8 onwards, and uses Java bytecode to show that partly compiled and partly interpreted is a design, not a compromise.

Objectives — Students can: (1) state what each translator does, an assembler mapping assembly language one to one onto machine code, a compiler translating a whole high-level program into an object file, and an interpreter translating line by line and running at once without producing a translated file; (2) give the benefits of a compiler (fast execution, shipping without source, all syntax errors reported at once) and its drawbacks (a rebuild after every change, platform dependence, harder error location); (3) give the benefits of an interpreter (edit and run at once, errors located to a line, suits learners and portability) and its drawbacks (retranslation on every run, so it is slower, and source plus interpreter must be shipped); (4) choose between them with arithmetic, comparing 3.0 seconds of compiling then 0.5 seconds a run against 0.9 seconds interpreted, a gap of 0.4 seconds giving a break-even at run 7.5, so compiling wins from run 8, and over 100 runs the totals are 53 seconds against 90, 1.70 times faster; (5) describe the Java route, source compiled to bytecode (100 KB to 60 KB) then run by the JVM either interpreted or just-in-time compiled, so one build serves several platforms; (6) name the four IDE feature groups and the pain each one removes, and explain that an IDE is not simply a compiler.

01 Prerequisites (3-minute check)

If any of these fails, fix it before the lesson starts.

Skill Quick check Pass mark
Machine code What does the CPU actually execute Instructions built from 0s and 1s
Assembly language Who are mnemonics such as MOV and ADD for People, and the assembler translates them
High-level languages Can the CPU read Python or C source directly No, it must be translated
Order of compiling Does a compiler translate as it runs or before It finishes translating, then the program runs
Two kinds of error How does a syntax error differ from a runtime error One breaks the format so it will not compile, the other appears only when that line runs

02 Lesson flow (60 minutes)

Time Stage Tutor does Student does
0-8 min Opening: the CPU reads machine code only Ask what happens when a Python file is opened, then introduce translation Say when translation happens
8-20 min Three translators Assembler one to one, compiler whole program, interpreter line by line State that an interpreter produces no translated file
20-34 min Compiler against interpreter: break-even at eight Compile cost, cost per run, break-even, one hundred runs Compute the break-even run number
34-44 min Errors and platforms All syntax errors at once, runtime errors only when run, platform dependence Say which errors a compiler cannot find
44-56 min Java and the four IDE groups Bytecode, JVM, prompts, breakpoints, stepping, collapsing Match each pain to a tool
56-60 min Practice and exit check Take three answers and mark them live Work independently

03 Teaching script (read it out)

Scene 1: Three translators, three methods

Start from one fact: the CPU executes machine code only, so everything a person writes must be translated. The three translators differ not in whether they translate but in what unit they translate and when.
An assembler translates assembly language, and the defining property is one to one: one line of mnemonics becomes one machine instruction. 40 lines of assembly give 40 instructions, no more, because assembly is only a memorable spelling of machine code. Students should state what that implies: an assembler barely optimises and does not reorder instructions.
A compiler translates a high-level language, and its unit is the whole program, producing a separate object or executable file; by the time the program runs the compiler is gone. 12 high-level statements can become 36 instructions, because one statement such as total = a + b * c needs load, multiply, add and store.
An interpreter also takes a high-level language, but translates line by line and runs each line at once, producing no translated file. That sentence is the most examined in the chapter. No output file means every run pays the translation again, which is why it is slower, and line by line means it can stop at the exact line that fails, which is why it debugs well. Make students state the cause and effect in that order.
Student task: choose a translator for three cases with one reason each: a program to ship to a client without giving away the source, a beginner writing a first loop who needs the failing line, and an image filter that runs billions of operations.

Say this: an assembler is one to one, a compiler finishes before running, an interpreter translates and runs line by line and leaves no file.

Scene 2: Break-even at eight, 1.7 times over a hundred

Turn the trade-off into arithmetic, because the exam keeps asking why one situation needs a compiler. Two numbers are enough: compiling takes 3.0 seconds, then each run costs 0.5 seconds, while interpreting costs 0.9 seconds a run because the translation happens again every time.
The break-even: the compiled total is 3.0 plus 0.5 times n, the interpreted total is 0.9 times n, the gap per run is 0.4 seconds, so 3.0 over 0.4 gives 7.5, meaning compiling is ahead from run 8, where 7.0 seconds beats 7.2 seconds. Over 100 runs the totals are 53 seconds against 90, 1.70 times faster.
Push the extreme case to show how wide the gap can get: the same billion-operation program takes 1.0 seconds compiled and 40 seconds interpreted, a factor of 40, because the interpreter re-analyses every line while the compiler does the work once.
Then argue the other side or students conclude interpreters are useless. A one-character change costs a 3.0 second rebuild, while an interpreted program runs the moment it is saved; 12 syntax errors are reported in one 3.0 second compile, while an interpreter reports them one at a time, 12 runs taking 10.8 seconds before the edits are counted, which is why beginners are less overwhelmed by an interpreter but shipping, speed and protecting source all point to a compiler.
Student task: compute the break-even run and say which translator suits a program run once and one run a thousand times, with one reason each.

Say this: run it a few times and the compile cost never pays back; run it many times and one translation is enough.

Scene 3: Java and the toolbox

Partly compiled and partly interpreted must be concrete, or students only chant that Java does both. The real route: source is compiled into bytecode, an intermediate code, 100 KB of source giving 60 KB, which is machine code for no real processor, so one bytecode file runs on any machine with the right virtual machine (JVM); the JVM then interprets it in parts or just-in-time compiles the hot parts into real machine code. The numbers: the first run takes 8.0 seconds, mostly interpreting and profiling, and after warm-up 1.2 seconds, 6.67 times faster.
The design buys three things at once: one build for several platforms, the portability of an interpreter and, through just-in-time compilation, most of the speed back. Students should also name what it gives up: an extra virtual machine layer, slower start-up and more memory.
The IDE comes last, and the point is that an IDE is not a compiler. It puts the editor, translator, debugger and build tools behind one interface, and the syllabus lists four feature groups, each answering a specific pain. Coding: context-sensitive prompts, so typing pri offers print, and across 500 statements saving 6 keystrokes each is 3,000 keystrokes, 15 minutes at 200 a minute. Initial error detection: dynamic syntax checks flag errors as they are typed instead of after 30 compiles of sixteen seconds each, which is 8 minutes of waiting. Presentation: prettyprint and expand or collapse blocks, so 1,200 lines fold into a few dozen blocks and a 60-line function fits on one screen. Keep the three apart: prompts help you type, live checking helps you find out early, folding helps you see.
Debugging: single stepping and breakpoints. Hunting a fault across 1,200 lines the old way means adding a print and rerunning, 2 minutes a cycle, 80 minutes for 40 cycles; a breakpoint costs 20 seconds a cycle, 13.33 minutes in total, 6 times faster. Stepping has the same arithmetic: stepping every line of the program takes 48 minutes at 25 lines a minute, while stepping only a 60-line function takes 2.4 minutes, 20 times faster.
Student task: a program starts going wrong at line 300. Say which feature to use, where to put it, and why not step from line one.

Say this: a compiler only translates; an IDE helps you write, helps you know early, helps you see, and helps you stop on the right line.

04 Question types and worked steps

Type Example Steps Answer
Choose a translator and justify it A fast image tool to ship to a client Weigh run count and whether source may be handed over, then the benefits and drawbacks Compiler: 0.5 seconds a run and only the executable ships
Total time and break-even Compile 3.0 s, 0.5 s a run, against 0.9 s interpreted Write both totals, set them equal for n, then substitute Break-even 7.5, compiling ahead from run 8
What no translated file implies Why an interpreter is slower every run No output file means retranslating each run, so the translation cost is paid every time 1.8 times slower per run, but edits run at once
Partly compiled, partly interpreted Java from source to execution Source to bytecode, JVM interprets or just-in-time compiles, then machine code 100 KB to 60 KB, 6.67 times faster when warm
Match an IDE feature to a pain Finding why line 300 computes wrongly Match to debugging: breakpoint there, then single step and watch values Breakpoint plus stepping, 6 times faster than adding prints
Sanity check (teach this): Six checks. First, an interpreter does translate, it just produces no translated file, so saying it does not translate confuses no output with no translation. Second, the break-even needs both totals subtracted, not just the cost per run: 3.0 over 0.4 is 7.5, so claiming compiling wins from the second run is wrong. Third, a compiler finds only static errors such as syntax and type faults; division by zero, an out-of-range index or an endless loop appear only when that line runs, so no compiler finds every error. Fourth, an assembler is one to one (40 lines to 40 instructions) while a compiler is one to many (12 statements to 36 instructions), and the two descriptions are not interchangeable. Fifth, Java neither interprets first nor purely interprets: source is always compiled to bytecode first, then the JVM interprets or just-in-time compiles, and the reversed order loses the mark. Sixth, an IDE is not a translator: it contains one, but prompts, live checking, folding and breakpoints are not translation, so calling an IDE a compiler drops four feature groups.

05 Independent practice (3 questions)

Question Answer What to watch
Compiling takes 4.0 seconds and each later run 0.3 seconds, while interpreting costs 0.8 seconds a run. Where is the break-even, and what does each cost over 40 runs? The gap is 0.5 seconds, so 4.0 over 0.5 gives a break-even at run 8 and compiling is ahead from run 9; over 40 runs the totals are 16.0 seconds against 32.0 Write both totals before substituting, and charge the compile cost only once
40 lines of assembly against 12 high-level statements averaging 3 instructions each: how many machine instructions does each produce, and what does the difference show? 40 instructions one to one against 36 one to many; the assembler swaps mnemonics while the compiler splits a statement into several machine actions One to one is spelling, one to many is translation
A 1,200-line program goes wrong at line 300 and needs 60 debugging cycles. Adding a print and rerunning costs 1.5 minutes each, a breakpoint costs 15 seconds each. What does each cost, and what else avoids stepping from line one? 90 minutes for prints against 15 minutes for breakpoints, 6 times faster; set a breakpoint at the function entry, then single step and watch values A breakpoint saves the edit and rerun loop, and stepping is only for the suspect stretch

06 Common mistakes and what to say

Mistake Student writes Say this
Saying an interpreter does not translate An interpreter just runs the source without translating it It translates as well, but line by line and at once, and it produces no translated file, which is why every run translates again.
Believing a compiler finds every error If it compiles, the program must be correct A compiler finds static errors only: syntax, types and undeclared names. Division by zero, an out-of-range index or an endless loop appear only when that line runs, so one such fault in 1,200 lines still compiles cleanly.
Calling Java purely interpreted Java is an interpreted language, so it is always slower than C Java compiles to bytecode first, 100 KB to 60 KB, then the JVM interprets or just-in-time compiles the hot paths, so it is only a little slower once warm rather than retranslating source every time.
Calling an IDE a compiler An IDE is the tool you use to compile a program An IDE is an integrated environment that contains a translator, and the syllabus examines four other groups: prompts, live syntax checks, prettyprint and folding, and debugging with stepping, breakpoints and watch values.

07 Homework (paper, section and question numbers)

08 Exit check (last 5 minutes)

Question Answer Decision
One definition An interpreter translates line by line and leaves no translated file Saying it does not translate means scene 1 needs redoing
One number Break-even at 7.5, compiling ahead from run 8 Saying the first run means scene 2 needs redoing
One order Java compiles to bytecode first, then the JVM interprets or just-in-time compiles Saying interpret first means scene 5 needs redoing

09 Tutor FAQ

Should the four stages of compilation, lexical analysis, syntax analysis, code generation and optimisation, be taught here?

No. Section 5.2 asks only for the need for the three translators, the compiler and interpreter trade-off, partly compiled and partly interpreted programs, and IDE features. The four stages belong to section 16.2 Translation Software on Paper 3 at A2. At AS level it is enough that students can say a compiler translates the whole program before it runs.

If a compiler is faster, why keep interpreters at all?

Because speed is often not the first requirement. While learning, running the moment a line is saved and being told the exact failing line matters more than throughput; 12 syntax errors reported at once can also overwhelm a beginner. An interpreter also needs no per-platform build, since source plus an interpreter runs anywhere one is installed.

Is Java compiled or interpreted?

Both, in a fixed order: source is always compiled to bytecode first, 100 KB to 60 KB, then the JVM interprets it at run time and just-in-time compiles the hot paths, taking 8.0 seconds on the first run and 1.2 seconds once warm. An answer that omits the bytecode step and says Java uses an interpreter loses marks.

Find a tutor — freeTutor Registration →

A TutorZone lesson-prep guide. Written by the TutorZone team; questions and lesson flow are original and are not taken from any school or publisher material.

Join as a tutor or coach — academic, music, sports, arts, STEM. Free to register. See how it works →