Chapter 3

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 30

Introduction to Computer Systems - All ChaptersIndex

3.1.Assembler
3.2.Assembly Language
3.3.Loaders and Linkers
3.4.Compilers
3.5.Interpreters

3.1. Assembler
Introduction
System software refers to the files and programs that make up the computer's operating system.
System files consist of libraries of functions, system services, drivers for printers, other hardware,
system preferences and various configuration files.
System Software consists of the following programs:

Assemblers

Compilers

File Management Tools

System Utilities

Debuggers

The system software is installed on the computer when the operating system is installed. The
software can be updated by running programs such as "Windows Update" for Windows or "Software
Update" for Mac OS X. Application programs are used by end user, whereas system software is not
meant to be run by the end user. For example, while Web browser like Internet Explorer are used by
users every day, they don't have to use an assembler program (unless the user is a computer
programmer).
System software runs at the most basic level of the computer and hence it is called "low-level"
software. User interface is generated by the system software and allows the operating system to
interact with the hardware.
System software is the interface between the computer hardware and the application software.

Assembler
An assembler is a program that converts basic computer instructions into a pattern of bits. These bits
are used by computer's processor to perform its basic operations. Some people call these
instructions as assembler language and others use the term assembly language. This is how it
works:
Most computers come with a specified set of very basic instructions that corresponds to the basic
machine operations that the computer can perform. For example, a "Load" instruction moves a string
of bits from a location in the processor's memory to a special holding place called a register. In
computer architecture, a processor register is a small amount of storage available on the CPU and
the contents of register can be accessed more quickly. Most of the modern computer architectures
operate on the principle of shifting data from main memory into registers, operate on the data and
then move the result back into main memory. Assuming the processor has at least eight numbered
registers, the following instruction would move the value (string of bits of a certain length) at memory
location 2000 into the holding place called register 8:
L 8,2000

The programmer can write a program using a sequence of assembler


instructions.

These assembler instructions, which are also known as the source code or
source program, is then specified to the assembler program when it is started.

Each program statement in the source program is taken by the assembler


program and a corresponding bit stream or pattern (a series of 0's and 1's of a
given length) is generated.

The output of the assembler program is called the object code or object
program relative to the input source program. The object program consisting of
a sequence of 0's and 1's is also known as machine code.

This object program can be run (or executed) whenever required.

Related Videos:
Next
Assembly Language

Ask a Doubt:
Misuse of 'Ask a Doubt' Section will be dealt as per the Terms & Conditions of Campus Commune
Note: Please do not use the doubts section for any quiz/quiz-content related queries.
Use the helpline () located above in top right corner for problems/queries related to quizzes.

Characters (including HTML): 0


Submit

Open Doubts

Closed Doubts

Nishi Aryan

My Doubts
about 13 hours ago

once we failed in course completion quiz, will I be permitted again for this quiz continuing my
previous scores????????
Madhusudhana KA

Reply

about 1 day ago

Any advantages of assembler..??


Aashish Patel

about 2 days ago

Reply

can any one tell me, how many times I can give a specific test?
Lali Vyshnavi

Reply

about 3 days ago

we are getting negative marks even though the answer is correct.

Ashish

about 1 day ago

Reply

Yes I also have faced this problem.

Durgesh Tiwari

about 21 hours ago

Same problem faced.


Rahul Rijhwani

about 3 days ago

it is written that miles earned from stage 1 will not be added in final mile count....does it mean that
we just need to pass stage 1 and the amount of marks scored does not matter ??

Veera Yerraguntla

about 3 days ago

Reply

I do have the same doubt...

Shalu Priya

about 1 day ago

Ya the amount of marks scored does not matter..but from stage 2 it matters
Suganya Sivakumar

about 3 days ago

assembly language is intermediate code.so it can be directly converted to machine language.


Aditi Dosi

Reply

about 3 days ago

How assembly language talk directly hardware??

Buddh Singh

about 3 days ago

Reply

Assembly lang is symbolic lang so when you pass instructions written in assembly through an
assembler they get converted into machine code they represent. which is what the CPU and its
various co-processors interpret and execute (its generally taken down into smaller units by the CPU,
called micro-ops). if you have to learn more you can follow this link
http://proquest.safaribooksonline.com/book/engineering/032124656x
Prajakta Barhate

about 4 days ago

Which software provides access to Internet? System software or application softwares?


Reply

Mohd Aliyan

about 4 days ago

Application Software

Ravikishan Divvela

about 4 days ago

The software that provides access to internet is DRIVER for NIC(Network interface Card). Any
DRIVER is a "System software".

Subhajit Barh

about 4 days ago

Actually Browser(which is an Application Software) lets you visits the web pages and renders all the
html or java script to nice readable text or images but Operating System such as windows handles
all the nics(Network Adapters) and the protocols(Like TCP and UDP) and lets the data flow in and
out. So technically both lets you have internet connection

Subhajit Barh

about 4 days ago

Actually Browser(which is an Application Software) lets you visits the web pages and renders all the
html or java script to nice readable text or images but Operating System such as windows handles

all the nics(Network Adapters) and the protocols(Like TCP and UDP) and lets the data flow in and
out. So technically both lets you have internet connection

Likhitha Kurupati

about 3 days ago

System software

Abhishek Gupta

about 1 day ago

application software

Abhishek Gupta

about 1 day ago

application software

Abhishek Gupta

about 1 day ago

application software

Abhishek Gupta

about 1 day ago

application software

Abhishek Gupta

about 1 day ago

application software

Abhishek Gupta

about 1 day ago

application software

Abhishek Gupta

about 1 day ago

application software

Abhishek Gupta

about 1 day ago

Abhishek Gupta

about 1 day ago

application software
Suganya Pachiappan

about 5 days ago

Register is a temporary storage?


Reply

Sankalp Bhatt

about 5 days ago

Yes. There value changes with the instructions that are being executed by the processor.

Sankalp Bhatt

about 5 days ago

Please correct.Their value changes with the instructions that are being executed by the processor.

Satish Prasad

about 5 days ago

Yes, it stores the value upto when there is no new instruction execution

Mohd Aliyan

about 4 days ago

Yes it is a temporary storage and for the fast execution of the resources we need it and it is a costly
memory unit so the size of register is limited.
Rajarshee Tribedi

about 5 days ago

what is assembly listing and it's relation to object code?

Mohd Aliyan

Reply

about 4 days ago

object code is converted back to the original instruction so we need assembly listing for example for
ADD the code is 1 for sub it is 2 so for transition of source code to instructions we need this listing

Previous

CC India

Next

Campus Commune

My Channels

Chapter 3: Systems Software


Introduction to Computer Systems - All Chapters

Home

Index
3.1.Assembler
3.2.Assembly Language
3.3.Loaders and Linkers
3.4.Compilers
3.5.Interpreters
Go to Doubts

3.2. Assembly Language


The native language of the computer is assembly language. The processor of the computer
understands machine code (consisting of 1s and 0s). In order to write the machine code program, it
has to be first written in assembly language and then an assembler is used to convert the assembly
language program into machine code.

Assembly language program consists of mnemonic codes which are easy to remember as they are
similar to words in English language. It consists of mnemonic codes for each of the different machine
code instructions that the machine understands. A mnemonic is an abbreviation of the actual
instruction. It is a programming code that is easy to remember because the codes resemble the
original words, for example, ADD for addition and SUB for subtraction. Examples of assembly
language program:
MOV EAX,2 ; set eax register to 2 (eax = 2)
SHL EAX,4 : shift left value in the register
MOV ECX,16 ; set ecx register to 16
SUB EAX,EBX ; substracts ecx from eax
An assembler converts this set of instructions into a series of 1s and 0s, also known as a executable
program, that the machine can understand.

Advantages of Assembly language

Assembly language can be optimized extremely well as it is an extremely low


level language. Therefore assembly language is used in application which
require utmost performance.

Assembly language can be used for communication with the machine at the
hardware level and hence it is often used for writing device drivers.

Another advantage of assembly language is the size of the resulting programs.


Since conversion from a higher level by a compiler is not required, the resulting
programs can be exceedingly small.

3.2.1. Assembly Language Programming


The assembler is a program which converts the assembly language source program into a format
that can be run on the processor. The machine code instruction containing binary or hex value is
replaced by a mnemonic.
Example

Advantages of using mnemonics are:

Mnemonics are easy to understand than hex or binary values.

Its less likely to make an error.

Mnemonics are easy to remember.

Assembly language statements are written one on each line. A machine code program consists of a
sequence of assembly language statements in which each statement contains a mnemonic. A line of
an assembly language program can contain the following four fields:
i. Label
ii. Opcode
iii. Operand
iv. Comments
The label field is optional. A label is an identifier or a text. Labels are used in programs to reduce
reliance upon programmers remembering where data or code is located.A label is used to refer to
the following:

Memory location

A data value

The address of a program or a sub-routine or a portion of code.

The maximum length of a label differs for different types of assemblers. Some assemblers accept up
to 32 characters long, others only four characters. When a label is declared, it is suffixed by a colon,
and begins with a valid character (A..Z). Consider the following example.
LOOP: LDAA #24H
Here, the label LOOP is equal to the address of the instruction LDAA #24H. The label can be used
as a reference in a program, as shown below
JMP LOOP
When the above instruction is executed, the processor will execute the instruction associated with
the label LOOP, i.e.LDAA #24H. When a label is referenced later in a program, it is referenced
without the colon suffix.
An advantage of using labels is that inserting or re-arranging code statements do not require reworking actual machine instructions. It only requires a simple re-assembly. In hand-coding, changes
can take hours to perform.
The opcode field consists of a mnemonic. Opcode is the operation code, ie, a machine code
instruction. Opcode may also have additional information in the form of operands Operands are
separated from the opcode by using a space.
Operands consists of additional information or data that the opcode requires. Operands are used to
specify

Constants or labels

Immediate data

Data present in another accumulator or register

An address

Examples of operands
LDAA 0100H ; two byte operand
LDAA LOOP ; label operand
LDAA #1 ; immediate operand (i.e constant value as operand)
The comment field is optional, and is used by the programmer to explain how the coded program
works. The comments are prefixed by a semi-colon. Comments are ignored by the assembler when
the instructions are generated from the source file.

Related Material/Video Links:


http://www.onlinevideolecture.com/electronics-engineering/nptel-iit-kharagpur/microprocessors-andmicrocontrollers/index.php?course_id=385&lecture_no=8
http://www.onlinevideolecture.com/electronics-engineering/nptel-iit-kharagpur/microprocessors-andmicrocontrollers/index.php?course_id=385&lecture_no=9

Related Videos:
Previous
Assembler
Next
Loaders and Linkers

Ask a Doubt:
Misuse of 'Ask a Doubt' Section will be dealt as per the Terms & Conditions of Campus Commune
Note: Please do not use the doubts section for any quiz/quiz-content related queries.
Use the helpline () located above in top right corner for problems/queries related to quizzes.

Characters (including HTML): 0

Submit

Open Doubts

Closed Doubts

My Doubts

Amol Baykar

about 2 days ago

what is difference between assembler and compiler??

Lokesh Khushwani

about 2 days ago

Reply

compiler converts a programming language to another language,whereas an assembler is a type of


compiler in which the assembly language is converted into m/c code.

Lokesh Khushwani

about 2 days ago

compiler converts a programming language to another language,whereas an assembler is a type of


compiler in which the assembly language is converted into m/c code.
Suganya Pachiappan

about 5 days ago

which make java platform independent?

Jayasuruthi Loganathan

Reply
about 5 days ago

Java Virtual Machine

Sankalp Bhatt

about 5 days ago

Java programs actual compile in a virtual environment known as Java Virtual Machine. JVM
understands byte codes(codes of a .class file) and convert them into machine code.. So, you see it
becomes independent of OS and processor as JVM has to do the conversion of byte codes to
machine code. Therefore, no matter what the OS or processor is just get JVM and execute any
.class file.

Gaurav Garg

about 4 days ago

Java code after compilation gets converted into Byte-code(highly optimized set of instructions). This
Byte code is the key behind platform independency of java. Byte code is platform independent
sequence of code ,Platform specific JVMs convert this byte code into runnable code , that's why java
is platform independent.

Nithin

about 3 days ago

JVM makes java platform independent. Because of JVM we say java is portable.

Suganya Pachiappan

about 5 days ago

Which language program can be used to determine cache size?

Sankalp Bhatt

Reply

about 5 days ago

Assembly level language programs.


Chandu Mahasamudram

about 6 days ago

Can we give Re-test even after scoring 50% marks


Reply

Sri Gollapudi

about 5 days ago

No, Once we clear exam

Aditi Dosi

about 3 days ago

NO , we can't.
Kajal Nayak

about 6 days ago

Advantage of using labels is not clear. please anyone explain in details.

Sankalp Bhatt

about 5 days ago

Reply

Labels are like identifiers. So when we use them to identify any value or instruction, we actually give
easier names to them. When any change has to be made or new code has to be inserted we do it
using 'labels' not actual 'machine code instructions'. This definitely adds to our advantage.

Gaurav Garg

about 4 days ago

Labels are helpful to refer to any instruction again in an assembly program.

Rudramani Pandey

about 4 days ago

1. In C,C++ We used to give a label so that Goto Statements can be used. Similarly here it is used
with Jump statements. 2) For large programs , multiple labels can be used for n times if the
statements are repeating . Thus we don't need to rewrite the program codes. Also we don't need to
make changes in every code.
Vinay Avudapuram

about 7 days ago

what is the difference between high level language and low level language?please explain with
examples....
Reply

Abhinee Chavan

about 7 days ago

High level languages are those which have syntax to remember which coding, for example C, CPP,
Java, etc. Low level languages are those which have op code and operands in the instruction itself.

Low level programs communicate with the hardware directly, whereas its not the same in case of
high level programs.
about 7 days ago

Abhinee Chavan

High level languages are those which have syntax to remember which coding, for example C, CPP,
Java, etc. Low level languages are those which have op code and operands in the instruction itself.
Low level programs communicate with the hardware directly, whereas its not the same in case of
high level programs.
Yugant Nayak

about 8 days ago

If I fail to clear the test in two attempts,will i be able to give it again?

Abhimit Ghosh

about 6 days ago

Reply

yes you can have N number of attempt to clear the test


Shikhar Chhabra

about 11 days ago

What is an opcode?
Reply

Venkat Thogaru

about 9 days ago

Opcode is the operation code, a machine code instruction.

Venkat Thogaru

about 9 days ago

about 9 days ago

Hardik Rathod

Small portion of Machine code that specifics the operation to be performed.

Arnab Mondal

about 8 days ago

ADD A,B here A,B are operand and ADD is opcode... the main instraction what to do that is the
opcode

Arnab Mondal

about 8 days ago

ADD A,B here A,B are operand and ADD is opcode... the main instraction what to do that is the
opcode

Abhimit Ghosh

about 6 days ago

opcode also known as OPERATION CODE basically it specifies what instruction is to be performed
Khushboo Barde

about 12 days ago

http://www.onlinevideolecture.com/electronics-engineering/nptel-iit-kharagpur/microprocessors-andmicrocontrollers/index.php?course_id=385&lecture_no=8

http://www.onlinevideolecture.com/electronics-engineering/nptel-iit-kharagpur/microprocessors-andmicrocontrollers/index.php?course_id=385&lecture_no=9
These links are showing Error 404. I hope it gets fixed ASAP.

Hardik Rathod

Reply

about 9 days ago

Hi, Here you go step by step, http://www.onlinevideolecture.com/ then select-> Electronics


Engineering Then > nptel iit kharagpur (From right side) and search "microprocessors and
microcontrollers"
Swati Gupta

about 13 days ago

What is advantage of label? Last paragraph about label is not clear...


Reply

Previous

CC India

Campus Commune

My Channels

Next

Chapter 3: Systems Software


Introduction to Computer Systems - All Chapters

Home

Index
3.1.Assembler
3.2.Assembly Language
3.3.Loaders and Linkers
3.4.Compilers
3.5.Interpreters
Go to Doubts

3.3. Loaders and Linkers


In a computer operating system , a loader is a component that locates a program (which can be an
application or a part of the operating system itself) in an offline storage (for eg. hard disk ), loads it
into main storage (also called random access memory), and gives that program control of the
computer (i.e. allows it to execute its instructions).
A program that is loaded may itself contain components that are not initially loaded into main
storage, but are loaded if and when their logic is required. In a multitasking operating system, a
program that is known as a dispatcher juggles the computer processor's time among different tasks
and calls the loader when a program associated with a task is not already in the main storage.
(Program here, means a binary file that is the result of a programming language compilation or
linkage editing or some other program preparation process).

A linker, also known as link editor is a computer program that takes one or more object files
generated by a compiler and combines them into a single executable program.
Computer programs comprise several parts or modules but all these parts/modules need not be
contained within a single object file. In such case they refer to each other by means of symbols. An
object file can have three kinds of symbols:

Defined symbols, which is called by other modules

Undefined symbols, which call the other modules where the symbols are
defined.

Local symbols which are used internally within the object file to facilitate
relocation.

For most compilers, each object file is the result of compiling one input source code file. If a program
comprises multiple object files, then the linker combines these files into a unified executable program
by resolving the symbols as it goes along.
Linkers can take objects from a collection called a runtime library. A runtime library is a collection of
object files which will contain machine code for any external function used by the program file which
in turn is used by the linker. This machine code is copied by the linker into the final executable
output. Some linkers do not include the entire library in the output, they only include the symbols that
are referenced from other object files or libraries. The libraries exist for diverse purposes. The
system libraries are usually linked in by default.
The linker also arranges the objects in a program's address space. This involves relocating code that
assumes a specific base address to another base address. Since a compiler seldom knows where
an object will reside, it assumes a fixed base location (for example, zero). The relocation of machine
code may involve re-targeting of loads, stores and absolute jumps.
The executable output by the linker may need another relocation pass when it is finally loaded into
memory (just before the execution). This relocation pass is usually omitted on hardware offering
virtual memory in which every program is put into its own address space and so there is no conflict
even if all programs load at the same base address. This relocation pass may also be omitted if the
executable is a position independent executable.

Related Videos:
Previous
Assembly Language
Next

Compilers

Ask a Doubt:
Misuse of 'Ask a Doubt' Section will be dealt as per the Terms & Conditions of Campus Commune
Note: Please do not use the doubts section for any quiz/quiz-content related queries.
Use the helpline () located above in top right corner for problems/queries related to quizzes.

Characters (including HTML): 0


Submit

Open Doubts

Closed Doubts

My Doubts

Nishtha Vishwakarma

about 3 hours ago

Need more explanation on linkers....


Jyothsna Guntakani

Reply
about 10 hours ago

Tell me is the loader follows any protocol if it follows name them?


Jyothsna Guntakani

Reply
about 10 hours ago

expain about relocation pass and seldom?

Lipi Barik

Reply

about 4 days ago

Rajeswari Lakshmanasamy

Reply
about 5 days ago

Object file itself is in executable format only right. then what linker do with them to turn it again into
executable one? need some explanations on linker functionalities.
Reply

Kavya Gangavarapu

about 3 days ago

Object files are not directly executable, linkers combines object files and makes into executable
file.... as far as I understood...

Divisha Mathur

about 6 days ago

How many stages are there in total in these modules ?


Ayush Sahu

Reply

about 7 days ago

Can't understand the 2nd paragraph.


Can anyone please explain it?
Reply

Pradyumn Jain

about 5 days ago

If any program is loaded in main memory and another component is needed in that program then
that component can be load in main program.
Sunanda Betal

about 8 days ago

Can anyone please explain when a program is known as a dispatcher?

Neha Dhade

Reply

about 2 days ago

It gives time to each process so it can be execute without interrupting each other. Its like time slots.
Sangeetha E

about 8 days ago

can anyone xplain about dispatcher juggles?


Reply

Abhinee Chavan

about 7 days ago

Dispatcher is a program in an O.S. which manages the tasks in the program to be executed.
Sayan Basu

about 9 days ago

Linkers use runtime time library, then why is the another arrow from linker to runtime library in the
above diagram?
Reply

Previous

Next

CC India

Campus Commune

My Channels

Chapter 3: Systems Software


Introduction to Computer Systems - All Chapters

Home

Index
3.1.Assembler
3.2.Assembly Language
3.3.Loaders and Linkers
3.4.Compilers
3.5.Interpreters
Go to Doubts

3.4. Compilers
A compiler is a special program that processes statements written in a particular programming
language and turns them into machine language or code that a computer's processor uses. A
programmer writes language statements in a language such as Pascal or C one line at a time using
an editor. The file created contains the source statements or source code. The programmer then
runs the appropriate compiler for the language, specifying the name of the file that contains the
source statements.
When executing (running), the compiler first parses (or analyzes) the language statements
syntactically one after the other and then builds the output code in one or more successive stages or
"passes" and makes sure that statements that refer to other statements are referred in the final code
correctly. The output of the compilation is called object code or sometimes an object module. The
object code is machine code that the processor can execute, one instruction at a time.
The Basic Structure of a Compiler
In the five stages of a compiler, the high level language is translated to a low level language which is
generally closer to that of the target computer. Each stage of the compiler fulfills a single task and
has one or more classic techniques for implementation. The following are the five stages of a
compiler:

Lexical Analyzer: Analyzes the source code, removes "white space" and
comments, formats it for easy access by creating tokens, then tags language
elements with type information and begins to fill the information in the SYMBOL
TABLE. The Symbol Table is a data structure that contains information about
symbols and groups of symbols in the program being translated.

Syntactic Analyzer: Analyzes the tokenized code for structure, groups


symbols into syntactic groups, tags groups with type information.

Semantic Analyzer: Analyzes the parsed code for meaning, fills in assumed or
any missing information and tags the groups with the meaning.

Code Generator: Linearizes the qualified code and produces the object code.

Optimizer: Checks the object code to determine whether there are more
efficient means of execution.

Related Material/Video Links:

http://nptel.ac.in/courses/106108052/

Related Videos:
Previous
Loaders and Linkers
Next
Interpreters

Ask a Doubt:
Misuse of 'Ask a Doubt' Section will be dealt as per the Terms & Conditions of Campus Commune
Note: Please do not use the doubts section for any quiz/quiz-content related queries.
Use the helpline () located above in top right corner for problems/queries related to quizzes.

Characters (including HTML): 0


Submit

Open Doubts

Closed Doubts

Nishi Aryan

My Doubts

about 12 hours ago

type checking is in which analyser


Felix M

about 14 hours ago

Shalaka Bhutada

Reply
Reply

about 16 hours ago

What is tokenised code?

Deepak Gond

about 9 hours ago

Reply

hii Shalaka as much i know in programming languages operators ,identifiers,constants,punctuation


symbols,keywords,string and numbers are consider as tokens. whenever a modified source code is

passed through lexical analyser , all comments and white space are removed and gets converted
into streams of tokens thus known as tokenised code
Vineet Pandya

about 1 day ago

What is qualified code?


Aditi Dosi

Reply

about 2 days ago

What is token passing ?


Kannam Shravya

Reply

about 5 days ago

Is compiler a platform dependent or not?

Vikas Kumar

Reply

about 5 days ago

Compiler is platform dependent.


Pushpak Waghmare

about 6 days ago

what exactly happens in semantic analysis??


Reply

Vikas Kumar

about 5 days ago

It will gives the meaning and sense for the source code and fill some other words such that machine
can understand easily.Semantic analysis will actually convert the parsed code to qualified code.
Siddhartha Seal

about 8 days ago

what is a parse tree?

Ravi Joshi

Reply

about 7 days ago

A parse tree for a string in L(G) is a tree where- the root is the start symbol for G the interior nodes
are the nonterminals of G the leaf nodes are the terminal symbols of G. the children of a node T
(from left to right) correspond to the symbols on the right hand side of some production for T in G.
Shubham Khandalkar

Saikiran Nedaganti

Reply
about 10 days ago

about 10 days ago

Reply

Previous

Next

CC India

Campus Commune

My Channels

Chapter 3: Systems Software


Introduction to Computer Systems - All Chapters

Home

Index
3.1.Assembler

3.2.Assembly Language
3.3.Loaders and Linkers
3.4.Compilers
3.5.Interpreters
Go to Doubts

3.5. Interpreters
Interpreter is a program that executes instructions written in a high-level language. There are two
methods to run programs written in a high-level language. The most common method is to compile
the program and the other method is to pass the program through an interpreter.
An interpreter translates high-level instructions into an intermediate form and then executes it. In
contrast to the above method, a compiler translates high-level instructions directly into machine
language. The compiled programs generally run faster than interpreted programs. One of the
advantage of using an interpreter is that it does not need to go through the compilation stage during
which machine instructions are generated. This process of compilation can be time-consuming if the
program is very long. The interpreter, on the other hand, immediately execute high-level programs.
Hence interpreters are sometimes used during the development of a program in which the
programmer wants to add small sections at a time and test them quickly. In addition to this,
interpreters are often used in education because they allow students to program interactively.

Advantages of using interpreter

Execution is done in a single stage.

Compilation stage is not required.

Alteration of code is possible during runtime.

Really useful for debugging the codes.

Helps in interactive code development.

Interpreter vs Compiler

The primary difference between a compiler and interpreter is the way in which a
program is executed. The compiler converts the source code to machine code
and then saves it as an object code before creating an executable file for the
same. The compiled program is executed directly using the machine code or
the object code. But an interpreter does not convert the source code to an
object code before execution.

An interpreter executes the source code, line by line and conversion to native
code is performed line by line while execution is going on (at runtime). Hence
the run time required for an interpreted program will be high compared to a
compiled program.

Even though the run time required for interpreted program is more, the
execution using an interpreter has its own advantages. For example interpreted
programs can modify themselves at runtime by adding or changing functions.
Compiled program has to be recompiled fully even for the small modifications
done in the program. But in the case of an interpreter there is no such problem
(only the modified section needs to be recompiled - refer Figure 3.6).

Glossary

A driver is a software that helps the computer to communicate with hardware or


devices. Without drivers, the hardware connected to the computer, for example,
a webcam, will not work properly.

An assembler is a computer program which translates assembly language to


an object file or machine language format.

A compiler is a computer program that converts source code written in a


particular programming language into another computer language.

A debugger is a computer program that is used to test and debug other


programs.

Application software, also known as an application or an app, is a computer


software that helps the user to perform specific tasks. Examples of application
software include enterprise software, office suites, graphics software and media
players.

Related Videos:
Previous
Compilers

Take Chapter Quiz

Ask a Doubt:

Misuse of 'Ask a Doubt' Section will be dealt as per the Terms & Conditions of Campus Commune
Note: Please do not use the doubts section for any quiz/quiz-content related queries.
Use the helpline () located above in top right corner for problems/queries related to quizzes.

Characters (including HTML): 0


Submit

Open Doubts

Closed Doubts

My Doubts
Abhishek Soni about 12 hours ago
which will take long time when the program is long.
Tusarkant Swain

about 5 days ago

Reply

Why in each attempt my Questions level is high in chapter 3 system software?


Reply

Narendra Singh

about 3 days ago

I don't think that's the case. Study and try hard next time.
Mala G

about 7 days ago

I have one doubt JAVA lang use


Interpreter or Compiler ?
what is JIT ?ANY ONE explained clearly.

Chandu Mahasamudram

Reply
about 6 days ago

JIT means Just In Time Compiler.The JIT compiler is enabled by default, and is activated when a
Java method is called. The JIT compiler compiles the bytecodes of that method into native machine
code, compiling it "just in time" to run. When a method has been compiled, the JVM calls the
compiled code of that method directly instead of interpreting it.

Sankalp Bhatt

about 5 days ago

Java has an execution engine which consists of an interpreter and a compiler. Java compiler is
called JIT compiler. JIT first converts byte code into machine code and then pushes the machine
code into memory. While interpreter converts each instruction and gives it to processor. So,
interpreter is efficient when a single statement is to be executed while with loops JVM gives the code
to JIT. Both are used simultaneously and this technique is called adaptive optimizer.
Sushmitha Nannapaneni

about 8 days ago

what is sematic analyser exactly means.............?


Reply

Nidhi Kaushik

about 7 days ago

Semantic analysis judges whether the syntax structure constructed in the source program derives
any meaning or not.

Nidhi Kaushik
Raksha

about 7 days ago

about 4 days ago

semantic analysis is the last by one phase where compiler is allowed to remove the incorrect
program

Raksha

about 4 days ago

semantic analysis is the last by one phase where compiler is allowed to remove the incorrect
program
Kanika Narang

about 12 days ago

in which debugging is difficult compiler, assembler or interpreter?


Reply

Nidhi Kaushik

about 7 days ago

debugging is difficult in compiler than interpreter because it generates the error message only after
the whole program is scanned.

Nidhi Kaushik

about 7 days ago

about 3 days ago

Narendra Singh

Compiler because interpreter allows debugging for each line


Supriya Roy

about 12 days ago

if i don't pass after 72 hr 2nd chance exam.then what is occur ....????

Hardik Rathod

about 9 days ago

Reply

Then You'll get another chance and then another.........

Arnab Mondal

about 8 days ago

You get another 72 hours for preparation.


about 3 days ago

Narendra Singh

You can try till your death but with gap of 72 hours.
Gaurav Sharma
Ramesh Sah

about 16 days ago


Reply

about 17 days ago

Which one is recommended either interpreter or compiler?

Ashwani Pandey

about 16 days ago

Reply

It depends on situation my friend. What you want Like Java is an interpreted language while c++ is
compiled lang. both have been invented for different purpose and are effective in it. so according to
me it totally depends on your choice. But, if your doubt is regarding the run time. then compiled
languages have a better response time than interpreter language thats why today also drivers of
computer peripherals are made using basic languages like C, games involving quick responses like
shooting games, these modules are written using c or c++ or any other compiler based language..
Satyaranjan Behera

about 17 days ago

Which is faster at runtime?Interpreter or interpreter


Reply

Kamini Singh

about 17 days ago

Compiler

Kamini Singh

about 17 days ago

Compiler

Kamini Singh

about 17 days ago

Compiler

Ripan Dey

about 14 days ago

Compiler

Supriya Roy

about 12 days ago

Compiler

Supriya Roy

about 12 days ago

Compiler

Asish Kumar

about 10 days ago

Compiler, because the compiled language consists of 0 and 1 which processor can easily execute at
runtime.

Pratyush Swain

about 8 days ago

Complier

Pratyush Swain

about 8 days ago

Complier

Narendra Singh

about 3 days ago

Compiler
Hameed Rahman

about 18 days ago

Dear sir,
In the study material it is written -- "An interpreter translates high-level instructions into an
intermediate form and then executes it. In contrast to the above method, a compiler translates highlevel instructions directly into machine language."
But if we analyze a java program then at first the compiler compiles java source code to produce an
intermediate code called Bytecode and then this Bytecode is interpreted by the Interpreter to
produce machine code.
Thus, a compiler translates high-level instructions into an intermediate form(object code). And an
interpreter translates high-level instructions directly into machine language.
Please explain.....

Ashwani Pandey

about 16 days ago

Reply

have a look at this link it has been explained better..


http://althing.cs.dartmouth.edu/local/www.acm.uiuc.edu/sigmil/RevEng/ch02.html#id2558687

Previous

Next

You might also like