0% found this document useful (0 votes)
115 views2 pages

Compiler vs Interpreter Explained

The document discusses different types of translators that are used to convert source code to machine code. It explains that compilers translate the entire program at once and report errors afterwards, while interpreters translate line by line and report errors immediately. The key differences between compilers and interpreters are that compilers execute faster but require more memory, while interpreters execute slower but are easier to debug. Assemblers are also discussed as translators that convert assembly language to machine code.

Uploaded by

Awdhesh kumar
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)
115 views2 pages

Compiler vs Interpreter Explained

The document discusses different types of translators that are used to convert source code to machine code. It explains that compilers translate the entire program at once and report errors afterwards, while interpreters translate line by line and report errors immediately. The key differences between compilers and interpreters are that compilers execute faster but require more memory, while interpreters execute slower but are easier to debug. Assemblers are also discussed as translators that convert assembly language to machine code.

Uploaded by

Awdhesh kumar
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/ 2

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.

The different types of translator are as follows:

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
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 translation of a Performs statement by statement


program as a whole. translation.

2 Execution is faster. Execution is slower.

3 Requires more memory as linking is Memory usage is efficient as no


needed for the generated intermediate object code is
intermediate object code. generated.

4 Debugging is hard as the error It stops translation when the first


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

5 Programming languages like C, C++ Programming languages like


uses compilers. Python, BASIC, and Ruby uses
interpreters.

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

You might also like