0% found this document useful (0 votes)
18 views

Computer Note

Computer

Uploaded by

M. Imran
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)
18 views

Computer Note

Computer

Uploaded by

M. Imran
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/ 5

Assignment name

Translator and it’s types


Subject
Computer
Submitted by
Muhammad Imran
Submitted to
Nouman Imtiaz
Student ID:
12270
Programs :
BS-MLT
Semester: 1
Date : 3/1/2020
Translator:
A translator is a programming language processor that converts
a computer program from one language to another. It takes a program written in source
code and converts it into machine code. It discovers and identifies the error during
translation.
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.
Purpose of Translator

It 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.
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

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.
A compiler is processor-dependent and platform-dependent. But it has been
addressed by a special compiler, a cross-compiler and a source-to-source compiler.
Before choosing a compiler, user has to identify first the Instruction Set Architecture
(ISA), the operating system (OS) and the programming language that will be used to
ensure that it will be compatible.
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.
.

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.
It is often used as a debugging tool for software development as it can execute a single
line of code at a time. An interpreter is also more portable than a compiler as it is not
processor-dependent, you can work between hardware architectures.
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.
Differences between compiler and interpreter

SI. Compiler Interpreter


No

1 Performs the Performs


translation of a statement by
program as a statement
whole. translation.

2 Execution is Execution is
faster. slower.

3 Requires Memoryusage
more memory as is efficient as
linking is needed no
for the generated intermediate
intermediate object code is
object code. generated.

4 Debugging is hard It stops


as the error translation
messages are when the first
generated after error is met.
scanning the Hence,
entire program debugging is
only. easy.

5 Programming Programming
languages like C, languages like
C++ uses python, BASIC,
compilers. and Ruby uses
interpreters.
Examples of Translators
Here are some examples of translators per type:

Translator Examples

Microsoft Visual Studio


GNU Compiler
Collection (GCC)
Compiler
Common Business
Oriented Language
(COBOL)

OCaml
Interpreter List Processing (LISP)
Python

Fortran Assembly
Program (FAP)
Macro Assembly
Assembler Program (MAP)
Symbolic Optimal
Assembly Program
(SOAP)

You might also like