Translators (CIE IGCSE Computer Science)

Revision Note

Brett Murphy

Expertise

Computer Science

Compilers & Interpreters

  • Programmers will write program source code using high-level languages e.g. Python, Java, C# etc. As programmers, we can understand source code as it is descriptive, easy to read, maintain and debug. However this is not good for the hardware as it needs to be converted into binary to allow the hardware to understand and execute it, this is known as machine code. For this to work it needs to pass through a translator first. There are two types of translators - a compiler and an interpreter

Compiler

  • This method will translate a program into machine code. Compilers convert the source code in one go into an executable file ready for distribution. This method is used mainly when a program is finished with no syntax or logical errors
  • Compiling may take time to be processed, however, this can be used over without needing to be recompiled every time, bearing in mind that the program contains no errors
  • Error reports are produced after a program has been translated. Common errors in code will allow the computer to crash and not respond, it’s important to be aware that if there are errors the source code must be changed to compile again

Interpreter

  • This is the method that directly sends the source code to the machine code. This will translate each line of code individually, if an error occurs the program will stop and an error message will occur. Once the error message is fixed, the program can carry on running from where the error occurred

Exam Tip

  • You will need to have a good understanding of the difference between a compiler and an interpreter. You will need to focus on features of compilers and interpreters or focusing on an overall comparison between the two
  • Although both translators find errors in code, they do not debug the errors - this is done by the programmer

Advantages & Disadvantages

Compiler


Advantages


Disadvantages

Run quickly as the program as the source code has been stored to be translated

Due to all code being compiled at the same time there must be enough memory space to handle this, if not and virtual memory is used it can be much slower

Compilers optimise the code, this code will run quicker and take up less memory space

If there are errors in the code the compiler will not identify directly where the error lies, making it difficult to debug

Original source code will not be seen, which is ideal for programmers to stop work being copied

It is designed solely for one specific processor

 

If the program is changed it must be recompiled

Interpreter


Advantages


Disadvantages

Program will always run, it will just stop when it finds a specific syntax error in the code

Each line of code has to be interpreted separately by the CPU, which can lead to slower execution

It is easier to debug and understand where particular code has gone wrong

Every time the program is run it has to be translated, due to no instructions being stored

Interpreters do not store instructions and are not stored for later use, this means they require less RAM to process the code

They cannot optimise code, it is translated and executed as it is

You've read 0 of your 0 free revision notes

Get unlimited access

to absolutely everything:

  • Downloadable PDFs
  • Unlimited Revision Notes
  • Topic Questions
  • Past Papers
  • Model Answers
  • Videos (Maths and Science)

Join the 100,000+ Students that ❤️ Save My Exams

the (exam) results speak for themselves:

Did this page help you?

Brett Murphy

Author: Brett Murphy

Brett is a passionate Computer Science teacher of over 9 years, he has taught in a number of schools across the Staffordshire, Derbyshire and Leicestershire regions. His aim is to bridge gaps and allow learners to build confidence and thrive within the subject and believe in themselves to succeed. Brett has continued to improve on practice by continuing to develop and implement resources to support learners in understanding the core concepts to succeed in their exams.