Translators - Classifying programming languages and translators - AQA - GCSE Computer Science Revision - AQA - BBC Bitesize (2024)

Translators

Any written in a is known as . However, computers cannot understand source code. Before it can be run, source code must first be translated into a form which a computer understands.

A is a program that converts source code into machine code. Generally, there are three types of translator:

Compilers

A compiler takes the source code as a whole and translates it into machine code all in one go. Once converted, the object code can be run unassisted at any time. This process is called .

Compilers have several advantages:

  • Compiled programs run quickly, since they have already been translated.
  • A compiled program can be supplied as an file. An executable file is a file that is ready to run. Since an executable file cannot be easily modified, programmers prefer to supply executables rather than source code.
  • Compilers code. Optimised code can run quicker and take up less space.

Compilers also have disadvantages:

  • The source code must be re-compiled every time the programmer changes the program.
  • Source code compiled on one platform will not run on another - the machine code is specific to the processor's architecture.

An interpreter translates source code into machine code one at a time. It is similar to a human translator translating what a person says into another language, sentence by sentence, as they speak. The resulting machine code is then executed immediately. The process is called .

Interpreters have several advantages:

  • Instructions are executed as soon as they are translated.
  • Errors can be quickly spotted - once an error is found, the program stops running and the user is notified at which part of the program the interpretation has failed. This makes interpreters extremely useful when developing programs.

Interpreters also have several disadvantages:

  • Interpreted programs run slowly as the processor has to wait for each instruction to be translated before it can be executed.
  • Additionally, the program has to be translated every time it is run.
  • Interpreters do not produce an executable file that can be distributed. As a result, the source code program has to be supplied, and this could be modified without permission.
  • Interpreters do not optimise code - the translated code is executed as it is.

Assemblers

Assemblers are a third type of translator. The purpose of an assembler is to translate into machine code.

Whereas compilers and interpreters generate many machine code instructions for each high-level instruction, assemblers create one machine code instruction for each assembly instruction.

Translators - Classifying programming languages and translators - AQA - GCSE Computer Science Revision - AQA - BBC Bitesize (1)
Translators - Classifying programming languages and translators - AQA - GCSE Computer Science Revision - AQA - BBC Bitesize (2024)
Top Articles
Latest Posts
Article information

Author: Ouida Strosin DO

Last Updated:

Views: 5975

Rating: 4.6 / 5 (56 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Ouida Strosin DO

Birthday: 1995-04-27

Address: Suite 927 930 Kilback Radial, Candidaville, TN 87795

Phone: +8561498978366

Job: Legacy Manufacturing Specialist

Hobby: Singing, Mountain biking, Water sports, Water sports, Taxidermy, Polo, Pet

Introduction: My name is Ouida Strosin DO, I am a precious, combative, spotless, modern, spotless, beautiful, precious person who loves writing and wants to share my knowledge and understanding with you.