You are on page 1of 27

HIGH LEVEL LANGUAGES

COMPILER
INTERPRETER
LINKER
ASSEMBLER
HIGH LEVEL LANGUAGE

A high-level programming language is an


advance programming language with strong
abstraction from the details of the computer .

Examples : BASIC,FORTAN,C,PASCAL A,C++,…


etc
ADVANTAGES OF HIGH LEVEL LANGUAGES

Machine independence

Easy to learn and use

Fewer errors

Lower program preparation

Easy to maintain
LIMITATIONS OF HIGH LEVEL
LANGUAGES

LOWER EFFICIENCY : High level language result in


multiple machine language instructions that may not be optimized, taking
more time to execute and requiring more main memory space.

LESS FLEXIBILITY : High level languages are less flexible


because they normally do not have mechanism to control a computer’s
CPU , memory and registers.
TYPES OF LANGUAGE PROCESSORS
COMPILER
A compiler is a translator program that
translates(converts) a high-level
language program (source program)
into its equivalent machine-language
program (object program).

Examples: FORTRAN COMPILER, COBOL


COMPILER, C COMPILER..
etc.
WHAT IS COMPILER ?....A DEEPER GLANCE

Compilers are large programs, which reside permanently on


secondary storage.

A compiler translates only those source programs, which have


been written in the language for which the compiler is meant.

Example-Fortran compiler is only capable of translating source


programs , written in FORTRAN
BASIS OF REQUIREMENT OF A
COMPILER

Program P1 in high
level language
L1 Machine code for
Compiler for L1 P1

Compiler for L2 Machine code for


Program P2 in high P2
level language
L2
TRANSLATION PROCESS
OF A COMPILER

HIGH LEVEL MACHINE


LANGUAGE INPUT COMPILER OUTPUT LANGUAGE
PROGRAM PROGRAM

One to many correspondence


(Source Program) (Object Program)
Machine code
Compiler for
for P1 that Executed on
language L1 on will run on computer A
computer A computer A

Program P1 Same results


and high-level obtained
language L1

Machine
Compiler for code for P1 Executed on
language L1 on that will run
computer B
computer B on
computer B
WORKING OF A COMPILER

 When a source program is to be translated, the compiler and the source


program are copied from secondary storage into the main memory of the
computer.

 The compiler, being a program is then executed with the source program as its
input data.

 It generates the equivalent object program as its output which is normally saved
in a file on secondary storage.

 Whenever there is a need to execute the program the object program is copied
from secondary storage in to the main memory of the computer and
executed.
SECONDARY FUNCTION OF A
COMPILER
Compilers also detect and indicate certain types of errors
in source programs, these errors are called Syntax Errors.

Some typical syntax errors-


Illegal characters
Illegal combination of characters
Improper sequencing of instructions in a program
Use of undefined variable names
RECOMPILATION OF A SOURCE PROGRAM
START

Edit source program


Source program
Compile source
program

Syntax Generate object


errors No
program
detected?
Object program
Yes
STOP
Generate list of
coded error
messages
INTERPRETER

An interpreter is a type of translator that translates programs


written in high level languages into machine language.

An interpreter takes one statement of the source program ,


translates it into machine language instructions and then
immediately executes the resulting machine language
instructions before taking the next statement for translation.

Examples: Basic interpreter , Java script interpreter


ROLE OF AN INTERPRETER

High level
language INTERPRETER (translates Result of
program INPUT and executes statement-by- OUTPUT program
(Source statement) execution
Program)

There is a need to repeat the interpretation process


every time you wish to execute the program
ADVANTAGES OF AN INTERPRETER

Interpreters are easy to write

Less complex

A syntax error in a program statement is detected and


brought to the attention of the programmer as soon as the
program statement is interpreted.

Require less memory space for execution.


DISADVANTAGES OF AN
INTERPRETER

REPEATED INTERPRETATION : Since during interpretation


,no object program is saved for future use, repeated interpretation
(translation + execution) is necessary for its repeated execution.

SPEED : Interpreters are slow while running a finished program


because each statement is translated every time it is executed
from the source program.
BASIS OF COMPILER INTERPRETER
DISTINCTION
The resulting object program is No object program is saved
OUTPUT permanently saved for future for future use.
use.

Repeated compilation is not Repeated interpretation is


REPETITION necessary for repeated necessary for repeated
execution of program. execution of program.

Syntax error is not detected Syntax error is detected as


DETECTION OF early. soon as the program
SYNTAX ERROR statement is interpreted.

CHARACTERISTIC They are complex to write. They are easier to write.

It is less time consuming to run It is slow while running a


TIME CONSUMPTION a program under the finished program.
compiler as it is faster.
LINKER

A Linker or Link Editor is a program that takes one or


more object program files generated by a compiler and
combines them into a single executable program which is
called a load module.
WHY IS LINKER REQUIRED ?... PART 1
ADAPTATION OF MODULAR APPROACH : A Modular approach is
adapted to develop reasonably sized software because….
A software often consists of several millions of lines of program code which
can’t be stored in a single source program file.

The large size of the file would make it very difficult to work with.e.g.it is
impossible to load the file for compilation on a computer with limited main
memory capacity.

It would make it difficult to deploy multiple programmers to work


concurrently towards the development of the software for completing it within
a specified time limit.

Any change in the source program would require the entire source program
to be recompiled.
WHY IS LINKER REQUIRED ?...PART 2
FUNCTIONING OF MODULAR APPROACH

Modular approach divides the software into functional modules and separate
source programs are written for each module of the software.

Often ,there is no need to even write source programs for some of the modules ,
because there might be programs available in a program library.

In modular approach , the software consists of multiple source program files

Each source program file is modified and compiled independently to create a


corresponding object program file (modules).

A program called a LINKER is used to properly combine all the object


program files (modules) of the software ,and to convert them into the final
executable program.
ASSEMBLER

An Assembler is a utility translator program which converts


(translates) assembly language program into its equivalent machine
language program , before it can be executed on the computer.

An Assembler also “assembles” the machine language program


in the main memory of the computer and makes it ready for
execution.

Examples:GoAsm,TASM(Turbo Assembler
Software), MASM,X86(-64),MIPS…etc.
TRANSLATION PROCESS OF
AN ASSEMBLER

Assembly Machine
language INPUT ASSEMBLER OUTPUT language
program program

One-to-one correspondence
(Source Program) (Object Program)
BASIS OF DISTINCTION COMPILER ASSEMBLER

It converts high-level It converts low level


PRIMARY FUNCTION language program into its (assembly) language
equivalent machine program into its equivalent
language program. machine language program.

It “compiles” a set of It “assembles” the machine


SECONDARY machine language language program in the main
FUNCTION instructions for every memory of the computer and
program instruction of a makes it ready for execution.
high-level language

There is one-to-many There is one-to-one


PATH correspondence between correspondence between
source and object program. source and object program.

TIME CONSUMPTION Less time consuming More time consuming.

CHARACTERISTIC Complex to write Easy to write.


BASIS OF ASSEMBLER INTERPRETER
DISTINCTION

PRIMARY It converts assembly language It translates high-level


FUNCTION program into its equivalent language program into its
machine language program. equivalent machine
language program.

SECONDARY It “assembles” the machine It immediately executes


FUNCTION language program in the main resulting machine language
memory of the computer and instructions
makes it ready for execution.

MEMORY SPACE Require more memory space for Doesn’t require memory
execution. space for execution.

OUTPUT The output given by assembler is The output given by


the object program. interpreter is the result of
the program execution.
BRIEF RECAPITULATION
A Compiler is a translator program which translates a high-level language
program (source code) into its equivalent machine-language program (object
program).

An Interpreter is a translator program ,which translates a high-level language


program into its equivalent machine-language program.It takes one statement of
the source program,translates it into machine-language instructions,and then
immediately executes the resulting machine language instructions before taking
the next statement for translation.

A Linker is a program , which takes multiple object program


files (modules) of a software , and fits them together to
assemble them into the program’s final executable form.

An Assembler is a utility translator program which


converts (translates) assembly language program into its
equivalent machine language program , before it can be
executed on the computer.
MADE BY:
PALAK AGGARWAL (9956)

KARISHMA BHASIN (9957)

DISHA KHANNA (9958)

You might also like