Translators - Programming languages and Integrated Development Environments - OCR - GCSE Computer Science Revision - OCR - BBC Bitesize (2024)

Translators

Any program 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 - this form is called .

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

Compilers

A compiler takes the source code as a whole and translates it into object 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 have several disadvantages:

  • Because the source code is translated as a whole, there must be enough memory space to hold the source code, the compiler and the generated object code. There also needs to be temporary working space for the compiler to perform the translation. Modern systems either have enough memory or use to hold all the data.
  • Compilers do not usually spot errors - the program has to be compiled and run before errors are encountered. This makes it harder to see where the errors lie.
  • 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 object code is specific to the processor's architecture.

Interpreters

An interpreter translates source code into object 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 object code is then executed immediately. The process is called .

Interpreters have several advantages:

  • Instructions are executed as soon as they are translated.
  • Since instructions are executed once translated, they are not stored for later use. As a result, interpreters require less available memory.
  • 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 more 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.
Translators - Programming languages and Integrated Development Environments - OCR - GCSE Computer Science Revision - OCR - BBC Bitesize (2024)

References

Top Articles
Latest Posts
Article information

Author: Virgilio Hermann JD

Last Updated:

Views: 5372

Rating: 4 / 5 (41 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Virgilio Hermann JD

Birthday: 1997-12-21

Address: 6946 Schoen Cove, Sipesshire, MO 55944

Phone: +3763365785260

Job: Accounting Engineer

Hobby: Web surfing, Rafting, Dowsing, Stand-up comedy, Ghost hunting, Swimming, Amateur radio

Introduction: My name is Virgilio Hermann JD, I am a fine, gifted, beautiful, encouraging, kind, talented, zealous person who loves writing and wants to share my knowledge and understanding with you.