Translators. Compiler vs Interpetator

11.5.1.7 analyze advantages and disadvantages of compilers 

11.5.1.8 analyze advantages and disadvantages of interpreters

Translators. Compiler vs Interpetator

How can we convert program code into bunary that a computer can understand it? 

Translators translates high-level language program into a machine language program that the central processing unit (CPU) can understand.  It also detects errors in the program.

Different Types of Translators

There are 3 different types of translators as follows:

  1. Assembler
  2. Compiler
  3. Interpreter

We consider two types: Compiler and Interpreter.

Worksheet to video

Compiler

A compiler is a translator used to convert high-level programming language to low-level programming language.  It converts the whole program in one session and reports errors detected after the conversion.  Compiler takes time to do its work as it translates high-level code to lower-level code all at once and then saves it to memory.

Interpreter

Just like a compiler, is a translator used to convert high-level programming language to low-level programming language.  It converts the program one at a time and reports errors detected at once, while doing the conversion.  With this, it is easier to detect errors than in a compiler.  An interpreter is faster than a compiler as it immediately executes the code upon reading the code.

Comparison Compiler and Interpreter.

A look at how compilers and interpreters work, and how their differences affect memory, runtime speed, and computer workload.

  A COMPILER AN INTERPRETER
Input ... takes an entire program as its input. ... takes a single line of code, or instruction, as its input.
Output ... generates intermediate object code. ... does not generate any intermediate object code.
Speed ... executes faster. ... executes slower.
Memory ... requires more memory in order to create object code. ... requires less memory (doesn't create object code).
Workload ... doesn't need to compile every single time, just once. ... has to convert high-level languages to low-level programs at execution.
Errors ... displays errors once the entire program is checked. ... displays errors when each instruction is run.

Sources: teachcomputerscience.com

 

Questions:

  1. What exactly are the differences between compiling and interpreting a programming language?
  2. What are the pros and cons of each?

Exercises:

Ex.1

Ex.2 (Author: Litvinova Olga - CS teacher of NIS Pavlodar)

Exam questions:

Категория: Programming languages | Добавил: bzfar77 (22.09.2020)
Просмотров: 221 | Теги: line by line, compiler, Assembler, Translator, object code, advantages, disadvantages, interpretator | Рейтинг: 0.0/0
Всего комментариев: 0
avatar