High- and low-level languages and their translators Flashcards

Syllabus: 1.3.7 Textbook: pg 256 - 259

1
Q

What is a low-level programming language?

A

A programming language that is easier for the processor to interpret but harder for humans to understand.

Two low-level languages:

  1. machine language/object code
  2. assembly language
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is machine language?

A
  • lowest level of language
  • consists of binary and/or hexadecimal
  • raw instructions that the CPU carries out (processor reads machine code directly, no need to translate it)
  • each CPU family has a different set of machine code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is assembly language?

A
  • uses abbreviations or mnemonics for each operation code
  • easier to read and write than machine language
  • must be translated into machine code by an assembler before it can be run by a processor
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an assembler?

A
  • translation program that translates processor-specific assembly code (source code) into machine code (object code) for a specific processor
  • translates an entire program but does not run it
  • it is rapid and reliable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

List some advantages of using low-level languages

A
  • complete freedom of choice of instructions
  • direct control over the processor’s communication with its input, output and storage devices
  • efficient programs can be written that:
    • fir into limited storage space
    • require limited RAM
    • run rapidly
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

List some disadvantages of using low-level languages

A
  • lack of relation to a human language makes it difficult for programmers to read
  • machine-oriented nature makes it hard for a programmer to learn, as each operation code must be memorised or looked up
  • processor-specific nature of the instruction set means that programs are not transferrable or portable between families of processor
  • programs are relatively hard to test, debug and maintain
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a high-level programming language?

A

A programming language that looks more similar to a human language or mathematical notation and is therefore easier for programmers to use. However, a program must be used to translate the language for the processor.

They are intended to help programmers solve problems rather than to micro-manage the computer’s hardware.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a compiler?

A
  • a program that translates all the high-level source code by compilation
  • compilation must be completed before the program can be run, i.e. the entire program must be translated before the processor can execute the instructions
  • if there are errors in the source code, the compiler produces an error report, the programmer corrects the errors and compiles the whole program again
    • therefore, the debugging of a large program before it can be run can be a slow, iterative process
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is an interpreter?

A
  • program that translates high-level language statements and executes them on a specific processor and operating system
  • does not create machine code
  • analyses one source code statement at a time and runs appropiate subroutines to execute it
  • if the interpreter finds an error in the source code, it produces an error report and stops the execution
  • the process of translation slow the execution, but debugging a large program is faster as the program does not need to be re-compiled after every edit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

List 5 differences between a compiler and an interpreter

A
  • compiler produces object code; interpreter doesn’t produce object code
  • compiler translates whole program in one go; interpreter translates and executes line at a time
  • compiler produces list of all errors; interpreter produces error message each time an error is encountered
  • compiler produces “stand alone code”; interpreter doesnt produce “stand alone code”
  • compilation process is slow but resultant code runs very quickly; interpreted code runs slowly
How well did you know this?
1
Not at all
2
3
4
5
Perfectly