You are on page 1of 25

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

Better documentation

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 low level language.

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 for
OUTPUT permanently saved for future use. future use.

Repeated compilation is not Repeated interpretation is


REPEATITION necessary for repeated execution necessary for repeated execution
of program. 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 a It is slow when running a


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

A Linker or link editor is a program that takes one or


more objects generated by a compiler and combines them
into a single executable program which is called the 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.

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:GPASM,HLASM,MACRO-11,TASM
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 into machine (assembly) language into
language. target computer’s machine
language.

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.
THANK YOU

MADE
BY-
PALAK AGGARWAL(9956)
KARISHMA BHASIN(9957)
DISHA KHANNA(9958)

You might also like