Software Types and Language Translators: Question 4
Syllabus 4.2
A small finance company is building a budgeting application in a high-level language.
During development, a programmer repeatedly changes short sections of code and immediately re-runs them to see the effect of each change. Whenever a mistake is met while running, the program stops at that exact point without checking any of the code that comes after it.
Before the app is released to customers, the finished, fully tested source code is turned into a single stand-alone file that customers can install and run without needing the original source code or any translator installed on their own computer. During this final translation step, if any error still remains in the code, a full list of every error found anywhere in the program is reported together, all at once.
(a) Identify which type of translator, compiler or interpreter, is being used during development, and describe how it processes the code to produce the behaviour described above. [3]
(b) Identify which type of translator, compiler or interpreter, is being used to prepare the release version, and describe how it processes the code to produce the behaviour described above. [3]
(c) Explain one reason the finance company chooses to use the translator identified in (a), rather than the one identified in (b), while the app is still being developed. [2]
Show worked solution Hide worked solution
Worked solution
Part (a): The translator used during development
The description matches an interpreter. An interpreter translates and executes a program’s instructions line by line (rather than translating the whole program first). This is why running a short, recently changed section shows its effect immediately, and why the run stops the moment a line with an error is reached. The interpreter has not yet translated, or checked, any of the lines still to come.
Part (b): The translator used to prepare the release version
The description matches a compiler. A compiler translates the entire program at once, before any of it runs, and produces a stand-alone executable file that customers can run without the original source code or any translator on their own computer. Because a compiler examines the whole program during that single translation pass, it can report every error found anywhere in the program together, rather than stopping at the first one it meets.
Part (c): Why an interpreter suits development
While the app is still being changed frequently, the programmer benefits from testing one small edit at a time and seeing the result immediately. An interpreter’s line-by-line translation gives this instant feedback without re-translating the whole program after every change, which is exactly the workflow described. A compiler would instead require the entire program to be translated before any of the change could be tested, slowing down this rapid trial-and-error process.
Final answers
- (a) Interpreter, translates and executes the code line by line, stopping at the first error met.
- (b) Compiler, translates the whole program at once before execution, producing a stand-alone executable and reporting all errors found together.
- (c) An interpreter gives immediate feedback on a single small change, without needing the whole program re-translated first, which suits active development.