High-Level vs Low-Level Languages

Computer Science: OCR GCSE, topic 2.5.1

High-Level Languages

Most computer languages are written in high-level programming languages.

High-Level Languages

High-Level Languages

  • High-level languages (HLLs) include most programming languages such as Python, C++ and Java.
  • High-level languages are made of human-readable statements that make it easier for us to program.
  • High-level languages are portable, which means that they can be run on many different types of hardware.
What does a HLL look like?

What does a HLL look like?

  • Commands in a high-level language look very like English. For example:
  • print()
  • SELECT * FROM users;
Why don't we always use HLLs?

Why don't we always use HLLs?

  • Computers can only process instructions in the form of binary numbers.
  • We use special software called a translator to convert our HLL source code into an executable binary file.
Advantages

Advantages

  • HLLs are quicker to create software because one line of code can perform multiple actions on the CPU.
  • A programmer does not have to think about how a program interacts with hardware. They can focus on creative problem-solving.

Low-Level Languages

Low-level programming languages are languages which are much closer to computer-understandable binary.

Low-Level Languages

Low-Level Languages

  • Low-level languages (LLLs) are much closer to executable machine code than high-level languages.
  • LLLs are harder to read by humans, but are easier to read for the computer.
What does a LLL look like?

What does a LLL look like?

  • LLL commands are not easy to read, and might include commands such as:
  • MOV ax, bx
  • CMP ch, dh
  • CLI
Why do we use LLLs?

Why do we use LLLs?

  • LLLs provide exact control over the central processing unit.
  • LLLs need less translation, and often lead to faster code which is useful for computers with low specifications such as embedded systems.
Comparison

Comparison

  • How would you write a simple addition program using values stored in two variables?
  • High-level language
    num1 = 17
    num2 = 4
    print(num1+num2)
  • Low-level language (Little Man Code)
    INP // Input first number
    STA A // Store it in mailbox A
    INP // Input second number
    ADD A // Add the stored first number to the second
    OUT // Output the sum
    HLT // Stop
    A DAT

Test yourself on High-Level vs Low-Level Languages

  • What does it mean for a language to be portable?

  • Which of these statements look like high-level language?

  • Why don't we always use high-level languages?

  • Which of these look like low-level statements?

  • Which type of language often have more optimised (faster) code?

Practise this topic for free