0% found this document useful (0 votes)
9 views7 pages

Block Structured Implementation and Error Handler

The document discusses the implementation of runtime storage and error handling in programming languages, focusing on local and non-local data management. It outlines the types of errors that can occur during compile-time and runtime, including lexical, syntactic, and semantic errors, and describes methods for error detection and recovery. Additionally, it emphasizes the importance of symbol tables and the phases of compilation in managing these errors.

Uploaded by

poonam2247backup
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views7 pages

Block Structured Implementation and Error Handler

The document discusses the implementation of runtime storage and error handling in programming languages, focusing on local and non-local data management. It outlines the types of errors that can occur during compile-time and runtime, including lexical, syntactic, and semantic errors, and describes methods for error detection and recovery. Additionally, it emphasizes the importance of symbol tables and the phases of compilation in managing these errors.

Uploaded by

poonam2247backup
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

11

Administration
Run time Storage
Implementaton ofF
Block Stue tured Languge

Storuge
Memory Space
(,

Locad Non-Local 1
Data Data

It is handling by AR. Itishanding by i


Scope Infosmation

Static
Dynamic
4 s Block Stmuchured 14 is non Block Stauccured
Storage Storage
Exauple of Local Data:
4 fiwst Clo Achuaton Recovd

nt 4,b setuTn Itill etum


Something
V Loco a

E xawple of Nou-Local Data: Cakulate c)


nt 6,c tor the to tal funchon i
for caleutate Vartable b and
Care lo cal

Block contains local


data
Land,fav Fhis o and p
are non
lotad data
int o,P ound ufce versq
E x a m p l e -

CalculaouC )

totx

Block2 8Lo8Lo ek 3
nt
8lock1

8tock 4
fnt ,s,t

B3 (9
Ba (x

t1 1,
ee
trroxDetection and Recovery

Lexfcal Analysis

Sytar Analysis
Semantic Analysis etieving
Essor Detection-+ Ebvoy
Tntexmediate ETToY
Symbol Hgndley +Eysor Kecovey
Crenerathion
Table
Code Optimization|
Tavget Code
Greneratoos
i

gure 1

Eysos

Comprle Time RunTime

LexicalPhase Suptache Semanic?hase


Phase Eo
ErroY Esros

figuve 2
Evvor Handler
detect every exvo% gnd vepost it to the
T h e main task of the
essox- handles process (s to
vecóver strateg gnd ímplement them to hand le esro.

uses, and
then make some
ghewd net be slo wear
During this ovevall process, the psocessína time of progsan
the blank entries in the symbol table.
Note: An evvor s

Theve are mainlt two types of esrors i) CompileTYme Evror 2). 8un Tme EsrOs
Compile -Time Evrors occovs at cempile time, betore,the finol executiton
of the pogsqm

Classification of Compile-time exsox


Evrov c. Semantic Error d). Logrcol Exso03
a). Lexical Esors b)i Syntactic

re
qrises in the first three phases of the.
compiler
ewors
Novmaly evror ip
Semaute Amalysts. f o e get
Lexfcad Analysrs, SyntacHo Analysis, and
hw?H perfosm operahon e . Evsordetochon,
the above phases Érórhandier
angof
.

to other
proceed
code wi u further
Sehieving and Ervoy recoveryafter that
Evrov Code Genevaor, CodeOptirnizatHon, TCG)
4Temainingphases Ce Intermediate
then
bf Compiler J-eCL A,$.A,Serm.
A)
If we get ervoxs mainly fisst thvee
to phases
Note yemaining phases
ofthe
to connect evsor Hähdle tothe
wby these s a need T Y

Compiler ie CIcG, Co, TCG) are not


LecaSyntachcand Semarnic
phases
The,veason that
3ometimeg
ambiauihes the'ave notoble to Teport
able to detect an evvoY,due
to some can be
aietected by first 3phases,
an enor Sothat évve shich as net
detected n the remaining phases

keyoosds ov opesatoss.
This inctudes mfospellingp of fdentitflers
a). Lerical Phase Evuors

Suppose, we have fdentiffessum


i.Exceeding Length of the identifier
of data-type Integer i e int sums
s of
TThis identi fer ov keyuoord
lu tength3, s ke7wnrd n v
vanable

fclentifierereeed
ufhe lergth of the
aqvto
ts Langunge
J n 'c" language wecan declave
clenHRer or
r vaviable of
p e cheracter, the wé can exteed ifs a up to 31

e talk abeut Fortran "langvage w e can declare a variable oF THP

Character, then uwecan erceecdiBs length atmest upto T


of
Note:- So if declares a variable sith name erueecdine ts atmast lensth the kind
eTor oe gets, Ex ceecding Lergthof denffer, and ites tpe.ofLexiattnoe
Appeavance of Illegal Chasatei 9t a,
mbo language s illego
nol
charaefe

ecoyex t
h e p o r i t ano
eletect 8uh ed
SoJexicat analyzer

e tangvot
Unmatchecl Sting or Comment b If wewant to pint Hello

oo9Helo p v 9irlst tott:


6utif we, miss stn
thak
then it will not be able to math +Hesina
91 y sodht to pntand the eincdo enors.bnmahhecd s hine
genera niye
2 If ini a prognam wrten in C language, o
ogam
din of *he
C o e u t for the better uhdersfandin of
the to de" }A

Rut f e tbi representccoHmen,comech or there. be, anj mfstokei


t h e . the emor uwft be of
tHeenmetehed cemmen

Exale

void manC
hovaid
iat a,,s vaiable deckootfon */ Commentis netvodel,

prbtfC%d, «h « tleg-, not vadud

Exa vuple 2 R a, 6,som


li
Eo Recovet throgh ianic Mod e
Leucal phase
i :1
ndi
Evey Lexicalhase Syntachie Thase Se mantic i'hase
EysoY Eyro EsTOr
Recouev
Methoc

fanic Mode Yes ol1"Yé9 N

hvase Level Yesi No


No

Ewoy iduction No ies)s ld


CGlcbal Prodiuctfon Nes No

Using Symbol loble No No yes

4. rlani
exicai Phase emos recover Hhrouph Panie Mlede

forthe givencode Fad d calcute, p12 Wiond a

befuoee
ranic Mode Recovery method veil ehch exim one by cne, and it dis tinguish
Aouoit knoup ihat uohen fo stopP
declavec vaniable bH Separetecd commaahd
Tt sicpsuofen itsee semcolon in the end
So, foi thegiven e e b ntsa daleutate9
oden Sto
loke oliscard haraiie

discor

'nthe8íven cod8
yn tactichase Ero
mMisspedled Keaiuf
ntac ric Thase Esvos; d) Mesing fareethesisl Msng Opeato
Exra blané space
place of Semicolon (
iV) Colon in

Missing Parenthesis eg printf C Helio" 5


(i Mising Dpexator
tiy Mfsspelled Keyeorel: wihle(ai0
.
ol 14 1lo
iv) Colon in plate of
em-to lon ielnta 1
Exhra blank Space 1 etha blank Spau Twrong Representaion
domnent 7
Receve ofSntachic.Phase Esros
i
1). ranic Mode In syotachc phase panicnocld racovey me heel e e slmiarey g in the
Recove eicad phase eo

2 hyase, leyel ecevery-hen parses en tounter an esro it pesform neessav acton an


semainina npuh ancl pass regtof rhe inpue

3) Ewov rocluchian Adcl an eta asdmmas produudhhan oand make an Augsnen ted (ramma
and parsd the inpu

Global Cosrection In this puse examines he ohole psugsm and toiee to fnd ou

closest matth oriF, ehich is emossrea, due fo


hgh spaue and tme ccmpleiby
it is not fmpleme nted practicall

You might also like