You are on page 1of 16

kCGkAMMING LANGUAGLS

W rogrammlng languages fall ln Lhree broad


caLegorles
1 Machlne Language
2 Assembly Language
3 Plgh Level Language
Mach|ne Language
W @he flrsLgeneraLlon programmlng language or

W L ls someLlmes referred Lo as ach|ne code or


ob[ect code ach|ne |anguage
W L ls a collecLlon of blnary dlglLs or blLs LhaL Lhe
compuLer reads and lnLerpreLs Machlne
language can be dlrecLly undersLood and obeyed
by a machlne (compuLer) wlLhouL
converslon(LranslaLlon)
W Pence Machlne languages are Lhe only language
undersLand by compuLers
W ach Lype of compuLer has lLs own machlne
language whlch conslsLs of zeros and ones
W rogram wrlLLen ln machlne language for one
compuLer wlll noL work on anoLher because of
deslgn dlfference
W Whlle easlly undersLood by compuLers
machlne languages are almosL lmposslble for
humans Lo use because Lhey conslsL enLlrely
of numbers rogrammers Lherefore use
elLher a hlghlevel programmlng language or
an assembly
W or a machlne language each unlque
comblnaLlon of 1s and 0s ln an lnsLrucLlon
has a unlque lnLerpreLaLlon lncludlng such
operaLlons as arlLhmeLlcal operaLlons
lncremenLlng a counLer savlng daLa Lo
memory LesLlng lf daLa has a cerLaln value
and so on
Asseb|y Language
W @he secondgeneraLlon programmlng
language or
W An assembly language allows Lhe programmer
Lo use all Lhe compuLer feaLures Lhrough
symbollc codes and locaLlons raLher Lhan
machlne codes and blnary
W 8efore an assembly language program can be
run on a compuLer lL musL be converLed Lo
machlne language uslng a speclal program
called assembler
W A program prepared ln assembly language wlll
requlre less sLorage and less runnlng Llme
Lhan one prepared ln a hlgh level language an
equlvalenL program ln a hlghlevel language
wlll be more heavywelghL
W Lowlevel languages are slmple buL are
consldered dlfflculL Lo use due Lo Lhe
numerous Lechnlcal deLalls whlch musL be
remembered
W Assembly language ls much harder Lo program
Lhan hlgh level languages
W Machlne languages are one Lo one
correspondence beLween language
mnemonlcs and execuLable machlne
lnsLrucLlons
W n assembly language one symbollc
lnsLrucLlon musL be wrlLLen for each machlne
language lnsLrucLlon however several llnes of
assembly language are needed Lo encode one
llne of a hlghlevel language program
|gh Leve| Language(LL)
W A PLL ls much more powerful programmlng
Lool Lhan an assembly language
W Plgh level languages are ngllsh orlenLed
language
W n assembly language one symbollc
lnsLrucLlon musL be wrlLLen for each machlne
langue lnsLrucLlon buL ln a hlgh level
language one sLaLemenL wlll produce a
mulLlLude of machlne language lnsLrucLlon
W A speclal program known as compller ls used
for LranslaLlng a hlgh level language program
ln Lo lLs machlne language equlvalenL
program
W AnoLher dlfference beLween assembly
language and hlgh level language ls LhaL lL ls
lmposslble Lo use Lhe assembly language of
one compuLer on any oLher compuLer @hls ls
noL Lhe case wlLh hlgh level languages whlch
are consldered problem orlenLed raLher Lhan
machlne orlenLed
W ne of Lhe flrsL PLLs was @An whlch
sLands for mula @AnslaLlon
W L was developed for Lhe 8M 704 by !ohn
8ackus and a Leam of LhlrLeen oLher
programmers aL 8M over a Lhree year perlod
(19341937)
W L was deslgned Lo wrlLe programs for solvlng
sclenLlflc and englneerlng problems
W 8L sLands for ommon 8uslness rlenLed
Language
W L was developed ln 1939 for solvlng buslness
compuLlng
W L has been used very successfully for wrlLlng
programs such as accounLlng payroll and
lnvenLory conLrol
W @he ma[or advanLages of hlghlevel languages are
LhaL Lhey are easy Lo read and are machlne
lndependenL
W @he lnsLrucLlons are wrlLLen ln a comblnaLlon of
ngllsh and ordlnary maLhemaLlcal noLaLlon
W rogrammers commonly use more ngllshllke
languages (called hlgh level languages) such as
8aslc !ava eLc Lo wrlLe programs whlch are
Lhen LranslaLed lnLo machlne language (called a
low level language) by an assembler compller or
lnLerpreLer
W
ASIC S1kUC1UkL CI A C kCGkAM
W @o lnLroduce Lhe sLrucLure of a program onslder Lhe
followlng slmple program LhaL wlll prlnL Lhe message
W I |ove pak|stan
W @he program may be wrlLLen as follows
|nc|udestd|oh
vo|d a|n()

pr|ntf("I Love ak|stan")


getch()

W @he # slgn lndlcaLes LhaL Lhls ls an lnsLrucLlon


for a compller sLdloh sLands for SLandard
lnpuL ouLpuL header
W ne lLem lncluded ln Lhls header ls a
declaraLlon of Lhe funcLlon prlnLf()
W A program conslsLs of one or more
funcLlons A funcLlon ls a seL of sLaLemenLs
LhaL performs a slngle well deflned Lask
W A program cannoL run wlLhouL a maln
funcLlon very program musL have Lhe
funcLlon maln () whlch ls Lhe flrsL secLlon Lo be
execuLed when Lhe program runs
W @he word vold before Lhe funcLlon maln ()
means LhaL Lhls funcLlon does noL reLurn any
value and Lhe empLy parenLheses means lL
does noL have any argumenLs
W @he body of Lhe funcLlon ls surrounded by curly
brackeLs and
W @he lefL brace lndlcaLes Lhe sLarL of Lhe funcLlon
and Lhe maLchlng rlghL braces lndlcaLes Lhe end
of Lhe body of Lhe funcLlon
W @he body of Lhe funcLlon ln our program conslsLs
of a slngle sLaLemenL prlnLf( ) whlch ends wlLh a
semlcolon
W prlnLf( ) ls Lhe sLandard ouLpuL funcLlon @he LexL
Lo be prlnLed ls enclosed ln double quoLesA
sLaLemenL ln ls LermlnaLed wlLh a semlcolon ()
W When Lhe program runs Lhe sLrlng Love
aklsLan" ls prlnLed on Lhe screen

You might also like