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

Operating Systems

information about

Uploaded by

Nameer AL-omari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Operating Systems

information about

Uploaded by

Nameer AL-omari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Language Processors: Assembler,

Compiler and Interpreter


Last Updated : 08 Mar, 2024


Computer programs are generally written in high-level


languages (like C++, Python, and Java). A language
processor, or language translator, is a computer program
that convert source code from one programming language
to another language or to machine code (also known as
object code). They also find errors during translation.

What is Language Processors?


Compilers, interpreters, translate programs written in high-
level languages into machine code that a computer
understands and assemblers translate programs written in
low-level or assembly language into machine code. In the
compilation process, there are several stages. To help
programmers write error-free code, tools are available.
Assembly language is machine-dependent, yet mnemonics
used to represent instructions in it are not directly
understandable by machine and high-Level language is
machine-independent. A computer understands instructions
in machine code, i.e. in the form of 0s and 1s. It is a tedious
task to write a computer program directly in machine code.
The programs are written mostly in high-level languages
like Java, C++, Python etc. and are called source code.
These source code cannot be executed directly by the
computer and must be converted into machine language to
be executed. Hence, a special translator system software is
used to translate the program written in a high-level
language into machine code is called Language Processor
and the program after translated into machine code (object
program/object code).

Types of Language Processors


The language processors can be any of the following three
types:
1. Compiler

The language processor that reads the complete source


program written in high-level language as a whole in one go
and translates it into an equivalent program in machine
language is called a Compiler. Example: C, C++, C#.
In a compiler, the source code is translated to object code
successfully if it is free of errors. The compiler specifies the
errors at the end of the compilation with line numbers when
there are any errors in the source code. The errors must be
removed before the compiler can successfully recompile the
source code again the object program can be executed
number of times without translating it again.

2. Assembler

The Assembler is used to translate the program written in


Assembly language into machine code. The source program
is an input of an assembler that contains assembly language
instructions. The output generated by the assembler is the
object code or machine code understandable by the
computer. Assembler is basically the 1st interface that is
able to communicate humans with the machine. We need an
assembler to fill the gap between human and machine so
that they can communicate with each other. code written in
assembly language is some sort of mnemonics(instructions)
like ADD, MUL, MUX, SUB, DIV, MOV and so on. and the
assembler is basically able to convert these mnemonics in
binary code. Here, these mnemonics also depend upon the
architecture of the machine.
For example, the architecture of intel 8085 and
intel 8086 are different.
3. Interpreter

The translation of a single statement of the source program


into machine code is done by a language processor and
executes immediately before moving on to the next line is
called an interpreter. If there is an error in the statement,
the interpreter terminates its translating process at that
statement and displays an error message. The interpreter
moves on to the next line for execution only after the
removal of the error. An Interpreter directly executes
instructions written in a programming or scripting
language without previously converting them to an object
code or machine code. An interpreter translates one line at a
time and then executes it.
Example: Perl, Python and Matlab.

Difference Between Compiler and


Interpreter
Compiler Interpreter

A compiler is a program that converts An interpreter takes a source program


the entire source code of a and runs it line by line, translating
programming language into executable each line as it comes to it.
Compiler Interpreter

machine code for a CPU.

The compiler takes a large amount of An interpreter takes less amount of


time to analyze the entire source code time to analyze the source code but the
but the overall execution time of the overall execution time of the program
program is comparatively faster. is slower.

The compiler generates the error


message only after scanning the whole Its Debugging is easier as it continues
program, so debugging is translating the program until the error
comparatively hard as the error can be is met.
present anywhere in the program.

It requires less memory than a


The compiler requires a lot of memory
compiler because no object code is
for generating object codes.
generated.

No intermediate object code is


Generates intermediate object code.
generated.

For Security purpose compiler is more The interpreter is a little vulnerable in


useful. case of security.

Examples: Python, Perl, JavaScript,


Examples: C, C++, C#
Ruby.

FAQs on Language Processors:


Assembler, Compiler and Interpreter

What is the difference between language processor


and operating system?

Answer:
Languages like Fortran and COBOL contain
language processors. Device drivers, kernels, and
other software are all part of an operating system
(or OS), a collection of software that enables
users to interact with computers.

What is Language Processor System?

Answer:
Preprocessors, compilers, assemblers, loaders,
and links are a group of programs that work
together to translate source code written in a
high level language, such as Java or C++, into
executable target machine code.

How many phases are there in language processor?

Answer:
There are mainly two phases available in
language processor.
 Analyzing the source program.
 Synthesizing the target program.

You might also like