0984

Programming Languages and Translators

Software · 4 question types

Exam Frequency Analysis

Past paper frequency (2018 to 2024)

This topic accounts for approximately 4% of your exam marks.

stable
Rare
Stable4%

Compiler vs interpreter differences are a recurring 3-mark question.

A uses English-like statements that are far closer to how humans think than to how the CPU works. Each high-level instruction usually corresponds to many machine-code instructions.

Examples named in the syllabus: Python, Java, C++, BASIC. Many others exist (JavaScript, C#, Ruby, Swift, Go, etc.).

A typical high-level program looks like:

FOR i = 1 TO 10
   PRINT i * 2
NEXT i

This program would translate into dozens of machine-code instructions under the hood, but the programmer never has to see or write those instructions.

Why high-level languages exist

High-level languages were developed once processors became fast enough and memory cheap enough that the slight loss of efficiency was worth the huge gain in programmer productivity. They let the programmer focus on what the program should do, rather than on the details of how the CPU does it.

Advantages and disadvantages of high-level languages

AdvantagesDisadvantages
Easier to read, write and maintainCannot directly manipulate hardware without special features or libraries
Easier to debug thanks to clearer syntaxMust be translated to machine code before running
Portable: the same source code can run on many different computers after re-translationMay be less efficient than equivalent low-level code
One line can do a lot: a single statement may correspond to many machine-code instructionsHides hardware details, which can hurt when fine control matters
Exam tip

Stating a benefit of writing a program in a high-level language

What comes up: A multiple-choice or short-answer question asks which statement correctly describes an advantage of a high-level language over a low-level language.

Write: The program is machine independent (portable): the same source code can run on different computers after being retranslated. Other accepted benefits include that high-level code is easier to read, write and debug than low-level code.

Watch out: Statements like "mnemonics are used" and "hardware can be directly manipulated" describe low-level languages, not high-level ones. Saying a high-level program is "harder to debug" is also incorrect — it is easier. A common distractor is the claim that high-level programs never need translation; they always do.

Side-by-side

FeatureLow-level (assembly)High-level (Python, Java)
Closeness to hardwareVery closeFar away
Closeness to human languageFar awayClose
Instructions per machine-code instructionOneMany
PortabilityMachine-specificPortable across CPUs
Speed of executionVery fastSlower (but the gap is small for most tasks)
Speed of developmentSlowMuch faster
Translator neededAssemblerCompiler or interpreter