0% found this document useful (0 votes)
23 views6 pages

Translators

Computer translator

Uploaded by

shakirabiola
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views6 pages

Translators

Computer translator

Uploaded by

shakirabiola
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

A program written in high-level language is called as source code.

To convert the source code into


machine code, translators are needed.

A translator takes a program written in source language as input and converts it into a program in target
language as output.

It also detects and reports the error during translation.

Roles of translator are:

• Translating the high-level language program input into an equivalent machine language program.

• Providing diagnostic messages wherever the programmer violates specification of the high-level
language program.

Different type of translators

The different types of translator are as follows:

Compiler

Compiler is a translator which is used to convert programs in high-level language to low-level language.
It translates the entire program and also reports the errors in source program encountered during the
translation.
Compiler

Interpreter

Interpreter is a translator which is used to convert programs in high-level language to low-level


language. Interpreter translates line by line and reports the error once it encountered during the
translation process.

It directly executes the operations specified in the source program when the input is given by the user.

It gives better error diagnostics than a compiler.

Interpreter

Differences between compiler and interpreter

SI. No

Compiler

Interpreter

1
Performs the translation of a program as a whole.

Performs statement by statement translation.

Execution is faster.

Execution is slower.

Requires more memory as linking is needed for the generated intermediate object code.

Memory usage is efficient as no intermediate object code is generated.

Debugging is hard as the error messages are generated after scanning the entire program only.

It stops translation when the first error is met. Hence, debugging is easy.

5
Programming languages like C, C++ uses compilers.

Programming languages like Python, BASIC, and Ruby uses interpreters.


Assembler

Assembler is a translator which is used to translate the assembly language code into machine language
code.

Assembler

You’ll also like:

Difference Between Type Conversion and Type Casting

Explicit Type Conversion (Type Casting)

Type of Parsing

Abstract Data Type – What is an Abstract Data Type (ADT)?

Next →← Prev

Like/Subscribe us for latest updates

About Dinesh Thakur

You might also like