• Aucun résultat trouvé

'Studj~ i~ ~iial iU~lImcQt

N/A
N/A
Protected

Academic year: 2022

Partager "'Studj~ i~ ~iial iU~lImcQt"

Copied!
123
0
0

Texte intégral

(1)
(2)
(3)
(4)
(5)

Impl em en b tl on orOataAbdrad!on.vta An- EventB....ed Pro•.!.~~.Tran . ror maUo n Technique

"\ B,

A tbesis 5ubmiLtcdtotbc~,chool~rpra d u:ltc

'Studj~ i~ ~iial iU~lImcQt

ortbc...

require~fIltsrorthed e&ree of M<LSterorScie oce

• ---'I

\ DepMtm eot ofCom puterSeieeee

~moriaJUlliYenit)'

ofNewfouadlaad November1'J85

St.John's

{

.

\ ''>c ' . ,~.

(6)

"

----

, "

sermteeron ha s been gran ted to th e National Library of. Cana d a to.mi cra\f i,l-m this thesis and to lend or sell .copiesof th e film .

.Tl\e-author(copyright owner) has re s e r v ed cttre r pUbl i c at i o n.rights, and n eLther the thesis 'no r exte n"s i v e ext r a c t s from it ma y.'be prLnted or othe r wise

•re pro duc e d ....itholl,t- !'lis/her 'w rit t e n pe r m i s s i o n .

L'autorisat iona t!t~accoedae

."a 1a Biblioth~que na tio n a l e

du cenede de microfilmer ' ceeee th~se at de pri!ter ou de vendre des ex emp.La Lr'es du

film.

.

..

. ,

, .

.

L'a u t eu r (titulaire diJ.droit d.'au teur) se r:~serve las euc r

ee

crcie s de pUblica tion:

I 01 1a thi)se n1' de longs"

ext raits de celle-ci ·ne

cot

ve

ne .~tr e impdm~s ou

autr-e men t.vee p r oduits sans son aU ~~isationsertee•

ISBN IJ- l l S- :H0' lJ2_2

. ,

/

(7)

/ -.

' . i l .

,..

Abiitiaet

,CODvtllt ioDaldataabstr 3e\ioll teeheiques coha.occ Icver?! 3.SlH'Cts ot:l. sorhoarcsy!-- tern.its

d~ve,1opemeo~.

maiotaioabilit y, ':US:l.biJih'aDd

(om~eDsibilit)'.

Howcver,

usioscoovelltiollal~ho iQ.Ut:SDoe mustmSllll:ll.ly implemt:llta dat:"lIbl tra.cLiollaodit's ophato rs,whicbma.yreaul\ io allioclfid ell\implemn ta t iC!Il. ·

, .

This

. .

paper illtroduct:5

_"

a~plozrlYTltraDronnation tecblliqlle wbkb m« boieaJl)'

.

,'implemeots a fixcd'dataabstrac\ioowit halimited set or dl1cieotiniplemeo\:iti~~s:

. ' . ¥

.Witbio tbe limited..eo~.thcevcntb:lollcdtedi oiqllebas.all'J.Ilt::W.Vlllltai~1orthe cOllveotio,oal

metbo~s,

aswell as,

allto~atic

a.od.

elfi~ieDt"1~p~emCDta.tiO~.

by;

~:liO~ ~!!

.inlillecodio&tec,~quewbicb.is b:sed 011tbepropert ics (aunb lltes)ortbcdatareprest: ll~

tatioll beilll usedtoitn pl~me ot lbed'1t aabstr:aetioo. .

....

\

-- ..

. \.

(8)

./

·Ad: DO ·~ I· me Dta

.. .. ...

~iii·

forpro.idiDa theiu iJ.bt10UffOWtlvprobltm toODe 01rnalJ leable porportioo.5.,.

,"

., .

I~Ml

,

w.Aleilike

to

Ihllkr.kiil'(i alU.ini-ilr

.

01N.wrollO

.

dlalld. torpro;id iDIthe .rndilllfor~tbfOQlhaOn"l llateFellow'bipIUd .Tn dlill&AMiataJI tabip.

.. .:i

.~

(9)

4.Au'tornati~CadeGeoeratioll 4.1 Abst ractallorithml

~---'-~--,.-~=~n~rMIDii---

', ' .

-.

.iv.

,

Tl bI,

' *

Content. "

,

T~bleorConteDta

-

'/LlstorTablea Llato rp i&url '

L In,trOductioll

,,'

,

-:)

3.EveDtB~dPrOSf:llJlT,a o,fOfmatiolls

6.Derivatioll ortbe Pro&ra.mCodelor:uIEvent .6.1D~eisioD. trl:"/(o.lldi_tio~alcompi1:r.tioll

::i ~~:::~ot;sset e"ellt.5 JodoftrbeadeUIlIS

6.~~etiYat ioDor theimplementation.code usinga decisiontree 7.ElI'ideneyorlmplemeo.tatioD

»<r: . "

11 11 18

~'ll

:.!.:l

""

",'

8. ~~·P~~:::;tti~~o~~~:Ple~ ..

8.~Insertalgoritbm 8.3 Re1:l.tiollaiSorltb/n

·16.

"

r.-l 62

(10)

r:

r

.- •

,.

S. mm:1.I'7 GO

10.eo;.du ioa,

J

73

BibiiolRpb1 74

..ApPflld ixA. 77

AppndiJ:B ...-~

. ..

1

APPflld ixC 88

Apptodix0' 02

.~_

.... ,

Ap~ lId ixE

'00

t,

.,.

(11)

I

..I

'

... -

_vi.

-Llatot Ta br;;-

Tablll 2BasiceVfnlain the lIoMtractalgorithms Table 3 EveDt.sauilable rOrll. 5ein tbe:Ullltru t algoritb mllI

Table 4Abat ractalgorithmsrcr~p ~leDtiDgtbestrillSahltractioo Tabte S OperMOt\letevellt;"

.

\

Table 6Overhe ad

~Yellh

Talie7

-EV~ Dt.s U~\.11

tbe

cOllv'~rt

algorithm

\, , .- '.

Table8 Eventsiiithe printalgorit~mthatDe~tobede rh~

Table'.1-Eventsillthe COllverlalgorithmtb:!,tDeed!-obeduived

Table10 Events intheill~rt::r.lgori thmthatneed tobederived T,ableIIEveDt~int~relatiollalgorithmtbatll~editohe derived

l~

"

16 17

"

(12)

.Yii.

LidorFlsure.

FilureI"

Figure11 Hedllce"ddeciliolltree required by <INIT:.DST >

~

"

"

st

'28 28

OS

,.'

37

38

40 \

"

,

..

sa CollvenillD

er

se arr3Y representatlea

toasinllylin kedliaLrepresentatiO)1l

COlll'eniollfroma sillilylillk.edlilt/~~,

to 3 doub!ylinkedtillg / ':

COIlYen iOIl (rom:ldoublylillk; ,,)

toall;lrr3yrepTeullt:ltion { (

I '

Filure2.

Filure3

Fil Ure0 Reduced·decil"fo~tree required by <INIT:SHC>

Fil ur;7 ..Decillo.. tree

111Y~IYed

ill

gell~n:tiir'itie

ecde

rralm~IlUw!lith reJ;lre:'!en tt~"e:;<INIT >"eyent

Filure 8 Deril'ation oftbc eode fral mefl.ts represeotiol the

<INIT:SHC> el'entin tbe eOllven algoritbm

-

,

Fi~u!e

L_

Dedsio ..t_r~forcodele:~t.a}i~~\

Filure6 ~d"ced',dcdsiontreee~e~" -~

Filure12

"

Figure13

.I

\

"

(13)

""~

...

'\

\ .. .

\1.Introduction '

\~"'b"'''''''

design.Itsuseallo~.

r

progr;lffimer to

i' 'id'I'''''P'''~'':''''P~'''i.m'i'

da.rib hisview ot a. 50ftwaresyae.,m

'"''''''

by the supr~iollorirrdtv4n'4t~[13,14,271.However,theconceptold~ta.ah.tnKtiolldoes lIot billltQ.u"" , dUr ell,tb;'~fuatiollof tbeprogn.rn. code requiredtoprovidetbe

im,Je"me~JGtio"

#IGil'jt bis

mUI~ ~

performedIIlG" Udlll/

bY"

tbe prov a..hmer.

Methodo[Olieahavebeendeveloped thathave provenusefulillthedesigll;md lmplerneatarion or~bstrae~,1l~5: _

~ ""p'roee~dural ImpJernell~atatlollortb~ dat~abstraction eed Itt.et or

--o~.\Ion••CoIIVeDtiOlla.lprogra.mming lallgllalu,such:IllP:lICal.CanLlFor- tr:l.ll,·havebeeausedas the implementat iolllallgual cs ormajorsoh waresys- tems.la.tb!'Rlanguage:!, thesubprol ra m,(fu:ctioll/Proeedu relmrch:Lnismis commonlyused whellimplemClltinlopera.tions thataretobe ueedillmany placu,auch udata absu actioll operatiolls. :

,

.

fii} Enca pl u Ja t loll orde. lin deel.tlon s.. A de:!igli'decisiollisimplemen ""di ~ypro- '1d1~li:aeollect!"11otsubprograr,ns(modu~e'L!h~iIesubprograms(:1.11beinv"hd fromotht rS~b~?.._r.a~,buttbt ir implrm tnlo!iondt/ oil. arehidd"nfromth..

relt orthe syall!'m.l27j.Thisilto pr'evr!itillcorrect Ult Qrtbell!'module.

_ _ (iii ) Hler",chleal ,t,uetu,ln, or module.. ThemOliulu oreompon.enL~that makeuptbesort~ ar esystem are implemelltedUaiD&:ihiernechicnl~tru(llI r~

.Thel.ortw3!e'"atemisereetedby implemeatias low levelmoduleswh"ich ar..

iattgutediototbelIext"bil huJe¥eI'of tbe system and10on.Tbishelp.clariiy

. . I

~ .

.

tbe'yltemaudallowstheprogrammer tomovee:l4llytrolion:~~ahauae- liODto:lllot her.

/

(14)

.,'.

_2_

The aboveluh Diqun . at tbeimplem~Dtatioolevel, eenaeeeth~·!<)ftw::r.r~'sdevelop- m~ot, co m pr~ heD slbl h ty.relLablhty.maintainabIlity. andreusalll hty However.10 US1Dg tbeabovetec:h Diquelthere ar~twoprohlemarea.!: ~

,i,ell a,eoera ll!OlutioDinunnsota data abltractiOll.tbe programmermust -";G~;'~providerhe implementation_,details.l?eJlf!lldill'Oil the.structureused.

thilclUlbeatriYialo rDoD-triYialplocellB. ,

(ii) EMc:I"nt:yor th"

,e,ultl.o~ Impl.m.nt.tlon~onal te.cbnique~

usea dyDamicorsubprogramapproachto implemeBt adataabstract ion.Usillg~he i~$3s orenca psula tionand bierarcb itll.lst, ud urin8.rurlher dYDamicor5ub~r....

gram levelllare introduced.Theimplementatioll of adata absiracti on alld 'lt.,

.'

ilo!I$GC iate dset oroperatioQS Callbeell"ide ntlyimplement edby most·program-

, , .

mers.laelficiellcywitbrespect tospac.eaDd timearise, wbeothese subprograms areu.tdtbrou"ihou tthe IOrtw1ll'e 5Ysl$m.Asubprogr31'Tl to perform lln3Cti~D witthavesubprov~m c~lsto manipulate tbe data·abstraction ;thesesubp.,c- ',ramamayheverurther subprogramcalls aDd1000.Toperform"allY operat ion

requ,ifn.~

large

tom.~~llieatioll

cverbead

1-4.71," .. .~

Tb~~\orkisall.illvntisatioll'illtothe autbmatiolloEimple~~lI.ti~,dat:l-,abstr'actio05 in a

CODY~lltioD:d

pro, r:ammiDgIaDguage;tbe abstra ctio:

u~der

cOll.ideratioDis tbe

",in,

or nquenu16.29.301.The'-j;;.plemeDtatiollderived Iho uld have tbeadv:mtagesor

cODveDt ioDll data~b5tractioD:developmnt,comprehelllibility ,reliability,m~intiliDabil­

ity....alld ,eul a bility,

~:rt~um;ire"

there

Ib~uld

be

mtdGni~al

Iranllal iGn

all~

efficienl

imple m t" 'GfiG nor l b e dll tll a~trnetio ll .

. ,

(15)

.\,

'

.

. t..-• .

-3"-.

Mu;b ofthemechanicsorth~systemimplementedbbasedallt.ht~~..,I;lll

rl'".';"'·

'~dfe~

pc.6grom

Ir~n'lormdliori

trcAniquel Z6J. The

,di3&.r~m

shownill;Figure l",,:prm'n15:10 5impli~edd~c;iptiobortb!i:plemn. l:l.lioDoftbto'!yslem.•

»:

':»

-

•Figure1 GtDtr.alst ruct ur'eor thes yatim

Tbe'sya~!fIll¥sanob.tio.ncalled.lI D3bstr:uitalgori.thm toreprestD.\ the-aerlon'til -.- - n e perrormed.Tbe:lb5lra.c~algoritbm,co!!t:liJisevents.which3rf"" embe~<.led,illthealgo- rit hm toac:t:lJImarkerstO,sbowwheredat33bst~~liollopd atiull'lI;itto~.f'f'rr~rrl1f'd...

' . ' . r . · . .

Oncegiv~lI;)dal:ldu cript or of thestrue turcto~usedl;m:lY.rfcllrd.tist,'i~It,..J:'...

the SJlstcmgl'ner:lluthecodehagmenls.These((KIt fragmentsnpruc olI~h~l!lIpl,:mt n-' '",

. / 1·

taliollcodeforth~ ~:lt:t.:lbstr:lelioQcpe reno ne lop1:'r:lltlr ftel )usi~••J,b'eftpedll~,j.,hl:l

\

' .

. .

'''''.

(16)

. '''' '

,

/ TIl~lb'l{ldJ,l, oritllm.1, tUtosrormtdi.1l1.olbeh2.!.proln mbylII. ill lth:"uu t

••( b~pro&r:lllltu u fOl'mal ioDttcblllqu.Tbu:uufotmaliolSI~ftla,formorIt'lt-lor·

. ~f~.

Int

,.blt~t.tio.'

lorL1Ie

.Pfti~f

un!aIlditsimplcmtDlaUo.(code (...mull.tUlle'

. r: ,

till.liltmort(ommoal,Iudtree-ree-ueestlMtitlUiouir.sMi,ot be, tnasronnatioa"""

, :!-";N I'; , "'! , - f.

- .

..

1.

oJ:.....

'"

W_. . .

(17)

2. Surv.l1Y

..

.5 •

In tbeautomaticprosr:un.mi olli..tdtb..teare fourm1in r..,n reh ..!T()r t~: hi~ b IH ~ 1 laD&u:lsn , process mod..l,tr:lDsrorm :at io D/p~o&?"msynt hesis,).fId howl..dl t based pro.

&ramm iol·

2.1.High levellauKUalu

...

.Th..termU5~.to idtl:llirytbis~ct io oCOY"'5a broadun, totbnlUllV5.!lown .."

1T!000 t or tb.. ,,..su tch being per for med C:lOM d:usified utttr two hn din ll5"

oOoP.locedural/ruDctioDal'progr:unmiDgaod5upportor:adY:lDC~PrO&lamin in, r..etur..a,·

2.1.1.No n p roced u.raI/Func~lo n . 1program mini

L:ulIU:lIUdevelepedusinl thisap pr9:ICbareconcernedwit hallo~iolttheploll a m-

Manyoooproc edur:l.l/funct iooal b llllu:ll n baveaJ lo rmosto rthe rollowililt (nlur .., ,, (i) A..odatl ve RefnenclollThe ability to3Ccessdat a b:aud onMImein l rin~ ir propertyofth..da ta.This 15 im pOlh llt~:austtbtIHQ~r:amrnff ,J"r~nuth"Yf"

tos~iry :loCC~s

.

p:atbs uplici l/y.

.

orpros, :un :an:alllori t hm to prrr" rm:a~r:lrc h ror:aSPt~i6cd:at:astruct ure

1 211.

A'II'IIreg a te Oper.ton ,The:ability topN for m conyoJlltrdQprr:ltiQ n~in:a sin- sJtstep.

'Iiiil,

I

Eli m in a ti onof ArbitrarySequendnll Thrrl imi o:atioll·o r :'\11sr'1 urncin~nQI rrqllir rd~ytbed:at:l.deprodr oc irs/ In nOllPfllcfidur:a.l/run r tion :aJprn~r:am mi nlt.

d:at:a depende eeles3rtIhown,,"xplkitlyby tbeopr~:alld..,prr:and;.{rllrturr "r th ..

(18)

prtlllram.Thereis DO~5ignmentorgoto.thecutecme desiredisspecijied :l:Ia rUDdioD orinput s,r:J.ther tb"Dindiearedbya5t~pbyste p~1I~lICeofprollra~

J ",,.

(iyl No.~determlnlltlcProrramrnlora.nd";;;lIe llamlTheabilityto~errorm tberollow inlltypts of op~r at iouisrt qu ired:

(

('1

Achoicerueeuee wbiebconeeptuallyexeeutes allpaths inparallel, wilhtachpath bavi llllacboictas:lllargument.

(b) AsucedJI"funclio n :l:Ilbe termin atlon orcomputatioo.

(e) Afailllrefll.oct ionMtb~termi oationorCOmllul:ltioo.

Wh~opertormiOIl:leboice'operation,ooly thosepathsth~treturna 5ueecSIlare eeeeldered tobecomput ati onsortbe'alsorit hms. La.nSllal(!lwitblhe ehciee rundioG,mayimplylheuseoftherollowioS::llltomalicbaektracki ol, pattero directed~atabase.searebes:s~dpa..tterudirectedillvoeation oftlllldion5.

Some1:L011la1"whicbra ilwitbi ntbeno n proee<!ura l/fun d ionale1assi6ealioo areF'P 121.SEn.j21landPROLOG

[81._~'

2.1.2.Support or ..dva.nc:C'dprogrammingrll&t~rtl

cedural],such:l.'IP:l&CaI aa dFortran,tobilberleYelhl.lllUaiCS{proc e~u ral lwh ichrell dil~

slIpportabslradionsandot.herad v:J.q.cedfeat u re5.

. I

Alpb:u d[3&1 a.ndClu 1221are two ormanysuch la oi llale 5.l~ be5l!t ...oIanluas esa dat i abslraetionis rcprueotedasaaclof objec ts :Illd :s ad or opera tioDsrorm aoi pulat inl - -thse 'jJecI5.Th~-a~traetionmech ani, m and theform~.yeri6cati on or.prosrams is

~H'"supportedbyIIsiogAlpbn d', form aQdClu's dustertoconstrain theopera t io lls

(19)

tiolldetailsl:22,3fol·

The introouetiollofll~Wpro&r'WImiD&ff:l.t ur~s ,such:1&,s~tll.ztl. 301aDd Call.

cu rrn t progummia,,[foj(Il"~alsocODSid~r~dtofa~wilhiptbis:U~a

'.2.Tr&D.tormatloo /Prol r &1QI)'nt bul.

Thisapproacbiseeeeere edwitb the deriva tiollof~rrici ~lltim p l~mn t atio o sofpro- jtrams~ylLIn,,u formatiollproc_.Thetr:ul!form at iOlucommOllly :I.l'eprodu et ioBrule based,Ifthe left haDdof a productiollruleis D)atc:bcd,tberi&ht bpdsubst it utionis made forth:lteeeu-eeeee. Theseprodutl iollrulcsare norm:uly eeneernedwithuplimll in jt "_' the ccatrcl:r.b5trletions(loops,-sere';~b ,.brabC~ibg,...) used118,~1butth~r~areolh~n .thtateee ee e eeedwith optiinizill&thedata1bstr:l(tio~i~PlcmcPt:&tiOli[4,;1' --, The traDdormlltionaiproc~"iAuv d toelimib:lu. tbe overbead (ommonly 33sociated

witbrnodul1rdcsllllor structur cdpro&nmmilil .Ell'ici~pcyis lhe m1jorC?nC~rllottbis :&pproac:b.

'.3.

Procca.mode l

Thc basiAoftb is 1pproacb

~

the rclationship

~twen

d1ta and the

pro~ram

ereue-.

ture.Adtcomp~,ilionof a prosrarrlinto di,lIndprecnseseeebeoht:Ulled by makinjt r __tbe PrG&;;:unand data

str~ctures

used represcnt amodtlof

tti~ r~al

wo';d !ituation.

T~~

decom p~sitiolldirtdlvujl ctl ,rc:u worldbeh\\~io,.aadtb~rchyisC33Yl!>maint:l.inalld logiullycorreet[ISJ.

TheJlL(ksoll

~C~iIOJ~etbodOIOIO'

J1folis

3Ppropri~U

on lyto tbe c133sof.problems whicbarc stro ngly Mid inhereMly'v queflt i3l,suchMdata proo:euinl .Th~hck~ond....ijtn. m~thodhMbeen3utom3t~d:lnd isc~ rrellt lyinuse by m:ulYcllmp:&lIi ~stopufurmtheir

(20)

- 8 ·-

dat~procni asoeed'IHI ,

2.4.Koowled ••baud pr osram mlnll

~

.:.T..:' ;=-.

~,p::"::o~::':":;':,,,::::ollee_med..

witb

repri~~~tinl

kaowledse80

t~at

it,eanbelused

through out aD aulomatedpeoeeeeiedeY~lap5OIUtiOIl!to problemswithin thesymbolie plalra.mmillldomaill.PSI13[i! suehI. !y!tem and wuimpl~mented.by usillg

.

hY~phue,: aD :u:qubitioll ph»e aad-. s)'llthes.ia phaae. The:u:quiaitio nphase througha aatunlJI.0l uagtdiak,sue aadtrace! ,-deY.elop! aprogram skeletonbC the!olutioolo tht probJem:"Tbeos)'nthtllis phu'f take!

: ~bt p~gr~m !ktl~~11

as. iIlPII.t.,.Usil!&.a.. rule

b~d

representa tie u of koowledStaDdthroulb jbe illttr:u:tioo'or~ eodinl.u~rt(PECOS)13[andallelJieiel1e)' expert(LIDRAI 13,ISI,f)'llth~sile,Lisp prol ramtwhieh imple'ment the'program~keletoo.

. . .

Thepsis)'sternhu eeee used to!olve th.eCaHowial'prohlclf\lI:,mem.be~hiptist , eeeeep rformulstion,8Ortinl;'~primes.reaehability aDdsimplee1~~i1leati~n[31.

(21)

3.Event.BaledProgram Tranlformatlon l

The eveerhased program-1t :t.ns!orm:t.tioD leehoiquepr~ntedin thispaperralls undertheTranSrOrmll.lloojP rogra m

s~e~l~

headIngorthe-prevIOus seell oll

Theteeh iqueusesall0&,'r4CIDI~ Drilh moOt3ti Olllo .pecifywh::r.taction mustbe performed:TIeabltradalgorithmis wriu el inpseudoP~3J:I.lIdcootainl m:uhrl [eveuts] which are used tospecifylbetype orop erat ioo thlt mustbepedormrd..

:Coll ide! aprintalgorithm which_~ulhecoouauofasequence(stri~ gl.The solutioll illvolvestheiteratio~over the striogaDd tbeprilltio&of the coatelluor tht curreatstate of.iteratiollIll tiltbeen,d.orstrio&ls deteemiaed.

(. Tbe.priot algoritb m·is the foliO-win!:

<INIT>

WHn.ENOTI<EOF>}DO BEG.IN WRITE{<NOW»

<MOVE>

END WRITELN

withthe rollowlo!O ota tlon

1

</NIT> ,-...."." u:tltl:l.h ~e·forItera llon oversequence

<;:EOF> ~ ln tfor end olsequeace

I'<,,~'p'\'C:l.. prOOuceconuotlorc urreot loC3l1oll lnseqenee

<MOVE> ~. move to out loc;n ioo illsequence

'/

(22)

-10-

Tb~priat allOl'ilhmCOIUisLi

oi

a5otqU~DC~ofIl~pt·wbifb will fnultilltb~coat~lIt,

. . - -

ofth'Irill".:'ri~i~"riU..:l.Tb~~nu~illIb~ab,lrxt aJl orillllll:U~ IlOl'm~11p:1J'1III~ter·

.il..:l toIl 1lll~lh..objftta to bemuip.I~.

I TlitpriQtaJ,oril .rab«orn~:

<!NIT:SRC> .

W~n.ENOTI

-es or :

StSRC»

pO

BEGIN

WRITE« NOW,;STSRC> I

<MOVE STSRC>

(iii. Til.pr~6ltST duo(" a'LlLl! n':iabJewhic kis .«d..:l 10a((tsStb~ ~urce

~uuceaadis.Mod to i.dieal.eth~cu ,eD'\stat. . orit~lati6i.

Th~'.rilltall oritllmCOllt~uIll.,~l'2.ti6u(nutsldIalmOl. tb<I'p"C~mrdto ,"yetb~prilltpro bl~m.Or pudilllOil th.,xlu:lldatarrprrs.rlltat iOll 1IH'Cf.Ib~PlOlr.».1n rodelimpl~mutatiOIlIrrprtl u lill'tbeiJ,oritbm nilbequill!dill'~~ut."

Forrn mp'1r,ifat:arra7rrpr f'Hll tatiollwnlltbe'00'.ymbol:ufIldofeequeeee m:uhr i' uw d,theprillt a110rith mb«omes:

(23)

/

STSRC:- 1:

WHll.E NOT(SRCIST~RCI~'0 ' )DOBEGIN WR1TEISRCISTSRCI);

STSRC;.;. STSRC+1 END;

WRITELN

witbtherollowillld eclarat ioD beillggenerate d:

VAR.

SRC :ARRAY

[1..1°1

OF Cftt\R;

~ , ,".E SRC.:INTEGER;

.Ifa sillIlylinkedlistwitb apoiau !tothe6rstel('ni~ntISRC)is~"",,:l.Slb...data .repr..5tllt~ o ll, thelltb,, ! ollo'!"ing decbr atiollwould be, cllcrat.ed:

TYPE LINK- "BODY;

BODY_RECORD

DATA:CHAR;

F'WDPTR: LINK .END;

VAR SHe:LINK;

STSRC:LINK;

andtheprilltalgoli tbmwouldbetr:llufo Tmedto tb.e'f ollow io&:

(24)

-12-

,STSRC:_SHC;

WHn.ENOT (STSHC... Nn.l DO BEGIN WRITE ISTSRC·.DATA):

STSRC:._ STSRC',FWD PTR END;

WRITEI:N

'Tbecod errr.gmen~~rePfe~~Un , .tbe.-even teintheprintlliloritilmaresllowoin '- .TableI,Tbenenl.ll lJ tileabstrac ta1lor it bm~t

u

markerain tbe abalra<:t:algorithmat

~bk ll:l.bstract operatio llBare performed,sllcb1.3,illit!:l.lhe~rilt'!~tion ov~~ ~q lle tice.

tnt.ror rfldoraeq~ eoce•...,A~shownIeT:lble~.the implement:atil?ncode fQrthe :I.!l4trac t open tiolllinvoke d bytbe.$~meevelltaresigniHcan!ly.dilereot ,The implemen- tatlo ncodeisde~n d e o tQpanthe~at:l.repr"~ntationinlIae.

TabJ~I Code fr3.&me nts re presentiDgt be eventaintb ~print:t.lloritb m

"1'<>

' :' /.

"

N~. Array Linked

,

List

<INIT> STSRC:_1 STSRC:- SRC

<EOF> SRC[STSRC j- '0' STSRC· .FWDPTR_ Nn.

<NOW> SRC[STSRCj ST SRC·.DATA

<MOVE> STSRC:- STSRC+I .ST SRC :- STSRC· .rWDPTR

Tbe above uam pleaintroducetheideasofabstract alto rith ma(data. repreun t atioo

" '

indepe nd.e nt )3ll~nen.u(operat loDs),TbeysbowitispOBsi~leto specifya soilitiooto 3 problem witb olltbvins toeonsiderspeeiBedatareprescnt:l.tions. WheD gillen. a spedOe dat arepreaentat ioo."it'js.PDs,ible totr~n.srormtbeabstrac ta11'Or,jthm50tbt it

(25)

-:::

-13-

",u tb~ ~hoiqll.alld alIsw.rilll10m. buic~- qU'st Ktas:

(iii Howdontil.~bliqueiaeorporate howl.d l.cODc.raiDItb.abltrKtioa.ia

(iii) lIaft,

.

.

Arediciutim pl.mea ta t iolllderjvecH

: i

\-

(26)

-,

·14·

nil !lKtioa iDUod1&ctt lilttltrmiDo~i.ted_i'"tblt1t.ItDIb:uitdprol r:lm tr1l11lormatio.tecbDiql/.1t:aD~,bow, lIow tilitP-:alimplltfDitlWio Dis&itlltfatN.

:_ritt n iD p5udoPaacalaDdcontai.. utn.'!126)_bkllare,WIttoiDdit:lletbepoiouill tbea1lorit bmit.bkhab'lr~toPitratioal mustbit pltrlonned.ne ntllU(opltrat iou). wbieba typical seaetal aJ,orilbm couldcOlltail,art:lllitialil'for Illtf.tioo onr!ItqUUCIt,

1 . ' . -,

l-fltfOttlldOr"qultllce~prod ucecollteDtI.orc urrellttoeat iollleeequeaee,••Alisloftbc .b»icIt.CIlUauilablecaa'" SteDif!Table2. .

/ .

~

T~11t2 Baaic NUts iDtbeabaUac:t a1&ofilbma

N~.

.

J?ncripti o.o

<INlT> illiLialiuforiteratioao';erseqllltice

<EOF'> ~trorell doraequeoclt

<NOW> produClttolllltotiol comlltloeatioaiDSfqlleaclt

\

. . )

<MOVE> mO.ItIOIIt~tJ«:atioDillsequDce ..

<CLEANUP> ped orm elu lIllpoperauODltLbeitodoIiter:alio,

to:l dCllinali.,. repr lt,u t:ltioo(DST}is tbe(ollowin,:

<INIT:SRC>

<INIT:DST>

WHn.E NOT «EOF:STSRC» DO BECIN

J ..

(27)

END

-IS -

<;-;OW: STDST>:_<NOW STSRC'>

<MOVESTSRC >

<MOVESTCST>

::~

. .

" e;

<CLEANUP ST-SRC>

<CLEANUP ST DST>

Wit btberollowinlnotation:

(i) SRCistbe lOuree.e qu ~neeof,tbe.eoll'Jertand CST istbedol (nlilion' uquenee wbichr« eivtSacopyoftbed:l.t:l.eeatainedinIbeSRC.

.(ii)

,.

~_.- -

.

Tbeprefix STdeD~teS :l.IIlJte~~ rid fewbithuneededto:u:ce" theeovreec r destinationsequence~nd

is

used to illdic:l.tetbecurrents.1at us of iteratioll.

It;':11I Icund moreeon....niellttoICp", 5f'll ttbe:1bstr~et:aJl olitb ms:lS:aprocedureor runclioll.asbelo....:

PROCEDURE CONVERT (<PAHAM> I

<LOC_VAH>

BE(lI~

<INIT tR<>

<INIT;DST~

\VJ,n.ENQ(l..lEOF: STSRC>1DOBEGIN

<NOW:.STDST>;-,~~V:STSRC>

<MOVE:ST SRC>

.<MOVE:ST DST>

END

(28)

_16_.

<CLEA ~"P:STSRC>

<CLEANUP:STDST>

END

.Je tbe.COllvert :a.Jgoritbrn thre are two eew eveoteintroduced, <PARAM >aod --<i;.OC_VAR> wbicb.at aadforpara~eter'listand loealvariable.declarationseeepee•

.tively.A completelistor all eUlltscao be fOlilldioTable3.

r

\

T;ble3 EventeaVailablefo'ru~eio 'tbeab.tradailori~hml·

Name Descrip,tion

<INIT> illiUalizeforiteratioll oversequelice

.

<EOF> tlClltforead of5equence

<NOW,) produce coo tellts of currentlocationio ~u cnce

<MOVE> moveto eextlceeueeiase'qvlt!ce-'

<CLEANUP:> performcleaoupoper ation attlferndoliteratio a

<ACCESS_SIZE> accesssizeor sequence

<ACCESS..LAST> eeeeeetastlccericeleeequeaee

<PARAM> ItDera~pa,:,meter declarat ionl~tbasic:1Ilorithm

<LOC..VAR>. leDe;a~ loc:aJYiu'iabledecl:.ratioa

<NULL_ADD> leGCrakemptyuqueocerep~lItatioD

<FN_TYPE > geaeute fUIIC tioDtypereq\lire~b.ydatarepresentatioo

Tbe CYeIIl1sbownill Ta'blc3,reprcsenta1:n:a.J~but\lscful5U~sCtoftbe ab5tr:u:t ,operation that.call be performedoa

t~~c

stq\lenc"c'(strind abstraction.

~silll

thecYcnt.\

. ,

(29)

-tT-

• 1

'bo _,ilTable 3the:r.bstnc t':al&orilllm~illT:abl~~...tltimplt'm'lllrd::l.1/d~~~:I.:a minim.zletorroni' Hrormallipul~iDI'th

. .

wqutll(~"(nliDll

.

:r.btlnc tao ll.

'

.

n.

.~Inl . r. p' noP,u.tiOGIoftbe ;at>,uad allor iUlnul;aAMSf'tIlill"PPtll~u.A ud ApptldtxB.••

/

ITabw 4

-

r

-

Ab.lrx t. al,oriUllnstor~prnell till l .Ib.strilllablU~tioa

Dl'KripiIOll

I >

AfPEND

CONVERT .ollyn! rrem Oil

...

. rr prclIelltatiollto ;U;othtr:-: .- 1.'11( COpy

DELETE

EMPTY' EXTRAcT'

rIND

INDEXOf

INSEJtT PRL"'IT Ptr,rSTRING

RELATION

*

SIZE

SHIFT

cIlPyalttillll (Si?,dalcascor COllvr rt )

delete11U1b!tr illl,"zivuitapll'itiooiD:ap:al.lIl 'Uinll:llld il' ICDltb

produ ... tb.cmpty ltr illl

. ..

~

utrulII~bstrfD'i.ainllibpos'it io.io:r.pat.OIIM ill1:a.ad

T tl

1.01111 " •

war ch tor.fu bsU illi'wit bili:lp:r.nlll ~triDI

,

t

lld, J:tb,l rrID11lU llTel:tol ),IClluaddr"" or lrrtrc:b:r. r ~lct IlItbcstr llll ..

- I

wrtoll"trio IID:lollotbr r ,

nl:lt~ sU~DI 1\ -~

(om p, rt',tTlII&'·'nko &n,lIhiu ll)' jOIlfor EQ.NE.LT.LE.GT

. ce

!u~p lit'd :U:lp:lr;unetn),

-'t- .

;

!hirtt'It mfqt , ld torri&h~illaDaU:l)' Ifpru t'Ill :llioll: IiDtt'fllllolllllo rit hm,Dots. :lilablt'.lo thell~t' rl_

,

r

.; \ -.

\.

(30)

· is·

4.2. Even"

Theevellt, .howlI illtheprevi; u,,edio ll wereuaed illtheab, trx t a.lllorilbmito

COII! ider theCONVERT al&orithmfrom"thePI'U iOUll,ectioll.

PROCEDURE CONVERT I<PARAM> )

<LOp_VAH>

BEGIN

<INIT:SRC>'"

<INIT: oST>

.WUIT.ENOT(< EOF:STSRC>IDO BEGIN.

<NqW:SToST>:_ <NO.W:STSRC>

<MOVESTSRC>"

l

<MOVE STOST>

END.

<CLEANUP:STSRC>

<CLEANtTP.STo ST > r,.,;

END

,-

Tbe a1»traet'.I&oritbmill ,pedft ed._illte rmsofthestrilll (!equeDce)a1»traet ioll;

'T beact ua ldat arep re.sellta"tiollUledfortheatrilll01'uquc llccaBecto thecooefullmCllt' IClltr 30ted torepreaut thee~el1'"(opcral.iolll)" COlllidertheCOllvcrsioll from311array rcpr.raclltat ioll(SRC) to:l lills.1y lillkedlistreprraellb .liOIllOST).Fiiure2 abowl:Isimple c,u.mple,

.,

(31)

·11)·

.

,

H.E~

. ..

JJ '~~:"t

..

~~

COllvers LOllof ::r. n ::r..rnyrepr esenh.lion to.::r. SLllgl,lillhdHs~,epreselllaLiol1

where/lEADi8"',pointerl~~be Jir~1cell in tbelinkedlist:ln d tbe'0'is IIsc.1I..

Tbe !ollowillllllpcdcd",ratiolliwollidbege e eraeed:

r

,TYPE'

NAME'-AItRAY\1..7!OFCtlAR;

L1Nl<_"BODY;

BODY_RECORD

DAT A;CUAR; (.cbar::r.~tetfield.) FWDPTR:;LINK

t.

rorw::r.rdpointer., E~:

The rollowin"ll'codeh::r.llmellls!epr e;entillll

~be

events wouldbe

&Cne~::r.lcd:

.

<PARM. I>

<INIT:

snc»

<INIT:OS1'>.

snc :

NAME;VAH DST:LINI":

VAn STSRC:INTEGER:

PREVD ST'~IP ST:L1t'O l<;

STSRC:_ lj NE W(ST DST J:

OST:_ 51D5T;

(32)

-'20-

IFPREVOST_Nll.THEN. DST:-Nll.

ELS~RI.T"

.FWDPT R:=NIL;

OISPOSE.(STDS!L _ ST DST".DATA STSRC:....STSRC+I PREVDST;_ STOST;

NEWISTDST);

PREVOST".F WDPTR:- STDST t-EM,PTYSEQUENCE ' )

<CLEANUP:STSnC> ~

<CLEANUP.STOST > .

.::::::::>

PnEVD~T:_NIL:

SRq STSRCj .,.'0' SRC!STSRCI •

<EOF;STSRC>

~

<NOWS"!"SRC> ~.

<NOW:ST DST>

~

__<MOVE;STSRC>

~

<MOVE:STOST>

~

.'

,

{A~t~p b....atiolloe how lhtIiyslf m gntralfsthe<'flitfr:Llm tll lswhichftpr t Stllt thtfYfBtfwiJIhegiveoil:lSectioo6.0.1

da t :LfeprfSt ol:ll iooio ijlie:3l1dthety pe ofcperarlo nbeiog perf ormed .Thecodefo rthe e: elll<CLEANUP;STSRC> ifnotobyioQs;thecodeff3gmfll.t gflltr3tedistbeempty sequence.10tbeCONVERT also r ithmthealr:Lyrtpfe~ot:t.t ioll(SRC)ispassed:L53 valli e pllflUlleleraDd theallorit~m~ptdormio la.;'Orl.dulrllc.' illeite rati on oytrthe 3U:Lyrtpre~ot3 tioo,theref oretherei:!lIoneedrOfaclf30llp o ~ntioo:t.lld thttrnpty

•. 3. Codl! leneratlon

1.:btP~vioIl15rctiooI 4.1 31ld4.:!b 3¥eiQtrodllcedtheidelU of 303bftfxt3lgorithm

;lIdfYfoh.

(33)

)

·21-

How'does the t«haiqueleaer:lte the pros r:amimplem~at 3tiollIIYfa the:lb. t r:lf t '- a,llori thmaudtb ecooe rralmeatsrepreseatial LberYeatll,'

The,tr:lDsformatioll~roc esaisprod uctio aru leb:Med:la~take.tbe form of tutsub- stitu tioti ror t hes ped8c ill. ta.Dceol auev..at,

Giveatheabstrac ta,ll ori tbm:, PROCEDURE CONVERTI <PARAM>)

<LOC_VAH.>

BEGIN

<INIT:,5RC>.

<INIT:DST>

WI-In.ENOT( <EOf':5TSRC>IDO B£G1N

<NOW:5T05T> :- <NOW:5t~RC>

<MOVE 5tSRC>

< MOVE 5T05T>

END

<CLEAt-.'VP5T5RC>

,

<CLEANUP STD5T>

END

Usiastbe eode rr:ll meDt••bowaillI«tioll4.2,tie:abstract:als orit bmistr:llnfolmf<lhy

The6ul P:u<':alimplemellta tioa arter tbe ialiDCcodialactioaisIbe rollowlng PROCEDURE CO!'l'VERT(5HC:NA:\tE;VAHDST:I.IXKI;

v

~rlRC

:INTEGER:

(34)

p{EVDST,STOST LINK;

BEGI~

STSRC:_ I;

NEW(STDST);

OST :_STDST;

PREVOST;- Nn.;

WHn.ENOTISRCISTSRC!_'Q')DOBEGIN STDST'.DATA :-SRClSTSRCI;

STSRC:~STSRC+1;

PREVOST:-STOST;

NEW(STDST);

PREVOST'.FWDPTR; - ST OST END;

IFPREVOST_Nn. THEN ,•

DST:_NIL -

ELSE'

PREVOST".FWDPTR:-NO.:

DISPOS ~I STD STI END;(.CONVERT-l

ISRCj~od:),siollyliokrdlist lOST).

(35)

-23-

a staticaod a dYllamicdata. structu re.Tbestat ic !tfuctUTU ibyolvetbfalloC3.lioo ot storagefor thestriogItcom piletime,examples are array' and u, ..r-dellllffl 'bticrecord

!t rllcIU~ Tbe dYD"\mlc stfllctUr" Illy )ye tbeallocat looorttora.ge3trun lillietum_

plesarea.oyu!er-d ellaed<.l,IJa.mleat ru ctuI hits nap,trecs

The strlolrcprcseJItati o lls thlt weuallowedIIItbesYI~marc

.

the ronowlng III OptloDally,I5lnlll can blye:l.caler wlllcbcouldCOlll3HI a lIoliemply lubsr l

oftberollowi llg:

[a]

(b)

«)

Theposit ioll of theIIrsl tlt me ntofthe drillg.Tbil ilacompullory

: ::,;:~::~:b~:b:'''~::;i~':''::'~~'' body <~,., i athe >amI

TbesizeortheItrial.

(ii) AllsUiogs have a dat ahJV",birb cootailll the acl1l31elemeot. of the mini.

Tbe rollowiol npreuot3l iDOIare"llow..d lOTtbedata body:

(b ) Sinll)'Lioked.Lilt fc) •~Ooub ly -L inhd List

(d) SillI ly Linked Riol fe) Doubly LinkedRibg

--

F'igu re3cont:aioiagraphic:JJyicwortbeavailab(e strill 'rr p", lflltatiOlls .

.f,

(36)

·2"·

Ficur, 3 AuJi abl, .tr ilicreprn u tat iolls

~

Singly linked List

. ... ~

"N"~ "' ~ .~ ~ .

. ~ ~

~

_ \ Ooubly. Linked" List

~ .

Array

.. " ... ~

, C D

. ... .

~

, l e D

~

, .1 C D

. ~

Singl y'Linked Rmq

~ ~ .

. ~ ~

Qill ~ .

Oo

.

"''''bty linked Rim;..

(37)

-i.-

.~.

The:t.bonisf:u from ...dd aitiu'c:ollKlioaofposaiblt' sUi'lnopn'M'lt:alioo!l.butd

prollammpr.IHpn.dill&01tiltdati Jtn lclu l'ftQ.~ .lllil1:'::t.1~a ui.i:alOfoo.·ui yi:al

, -

task.£""0ifthed3taslndllreis lrivi:aliti!lull:ltt'dioulproc:ne . b... tb proSl':IlIl- --mff'bs 10eODc:t~b.i~1fwitbarnyrWl.0'misctllaofllulillfoflllatioD.~tisr:a.rbeakrlor tbeproSTam mertodevelop a aoIutiolltotbeproblem(a1lo"ritb m ) I.lld ItI.tbtim plemee-

•tati'ou ddailsbtplov idtdby31:I"aul.om:t.tedp,O(tSS.

, .

) r

(38)

. .

.-2(1-

II.DerIvation of Proll'am Codefor an Event

Tb .. ueoLaintbe ab.trxt aJl oritbms are ql..d as mark.." to drlv..tb..tr3lldorma- tiel.procna.Tbe :lldorma tioollaketberor m of 3lI iolioe

codili~

ofth e codelragm e1115 reprewll tiolth" 0P<'r:r.tioIl8illvoked b)' theevelll5.

Thi8 8ectiODint roducest beid..aof decisiootree!! andsbows bowtbe,. call beused1.0

. ::,.::~~~::~:::~~"rn. ~d r un-time OP",,;z~q~f by

th.

;rn~l.rn.""ioo 0 1

0.1.Deell loat.ren./ con dIti onal compUatloa

,

.Cooditiooa lcompilat iollisamtt b3.llism.us..d in110me programminghllgU3&U'tO ,wi/ellliDoroll"variousst3te~..rllsi~aprogra m:Tbisisus..ru1ill tbat itallows tbe sa me prolramtobe rUllOildill"euntcompul..rl)'lt"ffi!I. aids debuuingaedIr aeingofth..pro- ....ThecODdition.!compilatioopto<:<'MC3D 11<'repr..uDted:IIae uplidt StqU"DC"

of

s~:h~:c::~::i:::::~:::t~t~::r~I:::::~o:r:~::~s

1Iuser

to~ e~it)'

tbe. ,

dOition lcomp·il:r.tiollprecess.Tbe decisice tr eeis:lneere

pr~

..nt3IioD

~iltillg

or.@

COllu w.llatioo oodes,(1)d ..cisioll oooes 3lId Ieav e,whicbccrreapcnd to prograni eod...Fig- ure4sbow.asimpledecil ioolr...

'-~'. ~..

(39)

.27.

-, withlb~(oUowiog libtatioo:

@

e

Fjgur~.jDeetstcetree(ur ,'" fode gcner11iop

cboicebeLweepdirre'en~ecce(ragments fond ilion wbic b musl bet.nt.ed at.nd eci.-iop n<Hle A,B,D,E.F --;~~nmcodewhichisused 10 build lheeo.le

frumentswhichrep,:eo tt~eevents ~: Tbe eodefr1&meDIs a.fegenera tedby-ppost ordertraversalotthed",ci~iollt'''e,

I whereat,, :idecisionoodeeD •theleft.su btreeIstraversed if the conditionIc,.

t

true,- otb·

/e~wise

(herightsubtreeistraversed, )

Forexam ple,illthe

.d~dsioD

tree showo

i~

Figur e'I,if

~b!

condition,!eolind ",, / werebolbtrue(COCt), the deeisionnee ill Figu re~would reduceto tht follo wiltl:

, I

I

!

(40)

/

....

Mter"thecOllca~ll atioaispuform;d,the ecde &ueratedis ABE.

IIillthededsi o ntrec/8ho...a illFigure"0..e(ooditioll.sCoeadOoJ.Clweretrue (Co' CI), the decision treeahowojoFigun4 wouldred ucetotherollowiog;

Figure 6 Reduceddecisioo treeO:O':'CI

Artercooc:atella tiollis performed,the codescae ratedi~ABF.Likewise,ifthecooditioll~

lIot Coand CI weretrue (-oc ocLI,:lltuthecl;lDca lcnalioll prceesstbecode ADE wouldbe

ti~Dprot eM th ecodeADFwouldbe genera ted .

The aboveexam plu show,b,..t.eetlll&ir aCDodi tl oll(c,)istrueor talse and\Ilio! a coon t.ellat iofl proceu,tbedecision treeIncnteseodc th as mcoLswhichIIrc:l.p'propfia te Carlbe&i~eIlulano!c,.

(41)

.2'0).

5.2 .Attribute.

For thisproj~t,ecedirio esin thf decisiontree.dependDO Ib_llri6ulu(prtl pr , \,')• of tbt' datal1!p1tMotat iooio 11M andthepa rt icul:t.revent.

To dderminltbe ecderlpf~l1tilll!,al1eVflll il1volYntherollowilll!,dfdsi ons (i) Whal.type oflYellt is bfilll!, derived?Eacbtype ofnent,whdber <INIT>.

<MOVE>.<NOW>..<EO F>•...•illulv esdifferentdfc ilJiooswbichdepeed upllltth eattribll tes.of1heparti cular evtfl.1.

(iiI What typeofdatartpr~Dtatiooi~beinl!,usedto_~~D-t.thedataabstr act ion?

Each datarepre&eotatatioo has att rib uteswhich disti l1&uishit:

(a) Sta t icor dyl1amie representa tion, (b) Ty peofiteration;

{II NOl1destru d ;ye.

,(2) Typeofdntructiveiteratio l1:

(II hlsertioll.

(ii) Dele tion.

[e] Anyattributesw~icblIudepecialcon~ideratiol1:

(I).The sluorastrinl .

(2) Thepositlollor the1:U~~lementte tbt'str io&

(3) Th1!posilioD orthelirstfl\mfDtinthestrilll

15.3.Operator letIven lllaDd eveebeadevent l

,

\

...

~._'-, /~-

AD D,e, olor,et evee t iaanIVlll t wholle:w.oeiatfd op t'r:I.tiollisperformed al run-

.. .

lime.Examplesor ope ratorSll u e ntl are: illili alile ror Ite ralionoyersequeDce.~II(or

(42)

.3lJ.

TableS O~r3to,sdeYebt5

Name Dncriptio D

,

<INIT> illjtiaJi'ctoriteratioQoverscqulZ.lIce

<EOF> tuttortodor seqlituc c

<NOW> prndu ce coqt clita otcurreotloe at ioD io l!oequt llCe (

<MOVE> -mcve tcnexrlccaticeInsequenee /

,

<CLEANUP> perforrn eleeu upcpereeioeatthecodoti te ~tiO ll

<ACCESS_SIZE> :lct cu aizc otaequc3C(

..

.'

<ACCEsSJ.:"ST> a~~culrllocaliollio sequence

O~erllu4utuU arcnellts...bost operatioll is performedatcompile-time.Examples oro~erbcadevellts are:parameter5pt'ci6catiooa,1oc:tJ...aria-bledeelararicea,fUlictiolltyp e deda.r::r.tiolu ,...Table6 ('botain.alistoftheneotawhicharccalled overheadeve nts.

Descriptioll

Icoerate para mClerdcdaratioDlo r-aln tractalto i!b m f erateloc :tJva.riablcdedaratioli . - -

!eDtrateemptys"lucDc crepresto ta tio o Itl t rate~DetloDt;perequired by datarep~ueDtatioD

I

(43)

. .

'

n tt Uit'1t...sy.or$ bo...illl lbt dtri"~lioll,ottbttoatrtPrP1f'Dl;IlI·~Ot1'i.tisto coosideraDru mple.Coolidtrtb tCONVERT tum pit

or

Stcttoll.4.0.lh-to:~ ' ~OIl rromSll arrayI'IfpT~sntatioll~SRClto:to~lIlly.lillhd·li.slrrprntmb t'ioll,(bSTI...itbout:t.- •

r

-31-

O~ntor

!WI

~nou' al'~ ll:llldl~

t'311ilyby

~ClYnlionl

r.:IoIa

~"~Xli~n

l<:'C:blliqll"

by llSioltbellllbprov arn(proc~ u re/ruetioalmK bllism•llo.t"Yu,lbf.~is "b.r, e d1D~o.-e. b udullod~. j tll11;11"11:lollimplemnl~oo.i>'ullnd."U UCal l1ot~ baad~usily bycoa n niooal daLaa&uxUoo.tfthliiquf'$b « HHcocnptle-ti lMo~

. ,' .

..

lionareDo t IlIppo,lH!ly,coon otto uJ'lull ql,lIn(110compile-lilMr.oet~..).

II

. tb ;

mdllodoJou

prntll~

io

th i , proj~t.

nuh,';" ' lIt . :MId "";"".l tt

.•nnt, arc hudlf.d bythe(alllC(dKisKJIltr~lrnecbllillm.The methodol o&J'IIIII11Pd..tc ".

.r>

ICDeraLe

I~tl

•whitbbappt'1II

~o

M

~bc implcmtolal;O~

codeorao

~u;ICi ~r'~rll~m

.

I . ,,10' , "". ,1"d, " "'''~; .."". Tbo ,,~ , .".;;;..,

I.,

"..;,m ~.~'" .tiI~

b30dl~ bot~ CO~Pile:.time

(o,erbudenots)alldruo.time

(~rt:ll.or ~t)

":lSPCC Il

J:od~

ICDer~t1oD.

thi,beia ",. 'e1:juinmcolror

~lll.Omatic

prO!'::lm

Ine:~tlOIl'1

; '

/

\

0•••.Derly.~tloll(lUb. lmplem'lltatlollcod.u~m~;.,d.clalolltree '-..

Tile dtrin d OIlof tbt

i~pltmellblio,

eede

rcprr5C~ti'l

Ul

"t~l

dtpelld1llpoaibt·.

0' ,

suribl l.eor~tbedsts ~pnwllt ~ i OllSlid t.be t1'CII1.&il!rrulOPCD ton4tpell~011 dirt/fllil~rtin l~triblr.nlortblfdsu~prt50tlll:Uiol(DOlt.t".sminllfalrcu

t ,~. \• I

ntryo~rstOf#. ,.

I

-:-.

. ' \ ..

bt:ulercell,

..

, .

..~.

/'

(44)

c

TyP E t

NAME~-ARRAYI1..11OF' CHAR;

LINK_'BODY;

BODY_ RECORD

DATA : CHAR; (0datafield0) F'WDPTR:LIM<; (0 forwardpoiat er0) END;

Thesyste m thtllJfoDsidelll theab'tfadalsori thmrorthe CONVERT:

PROCEDURECO~RT(<PARAMj" ) .:<LOC_YAH>

BECIN ,<I NIT SRe>

<INIT:OST>

WHILE NoT «EOF: STSRC> ) DO'BEGIN

~ow:STOST>:=<NOW:STSRC>

.<MOVE:S1'SRC>

<MOVE:

sros;'>' .A ND . . ..-

<CLEANUPSTSRC>

<CLRANUP STOST>

END

' .

.Theflvnt.artt~trllCttdrmtIilr":ibsU3ct a1t.orit bm;T:l.ble7(Dala ilu:Llist of the ivnll

- i~

HIt

(Oovutal~O'~it~m ..

tbat DfMth;ir codetragmtll ls

Itbera~d.

E~beVf'oLiscooed Ulingattributes,~~~~$!~romtbe datildesniptoraDdthe absI Ut t:r.l,;ori t bm.

.,

(45)

. -.

\

.

.33 .

EyeD' Onrri ptioll

<PARAM> ~r;amelerd~I;U":ltioD(or2bun d 1I1orlt hm

<LOC_VAR> ,Iox::al uriabledMI.u~iOllfor:ab$U:lCt';lI lOfit bm

<INIT:SRC~."1 illili~iuIOGICesequnc~rOfiteruilll

a

<INIT:OST>: iDilialiu destint.ioDuqlUlceforitc rat~

<EOr:

ST.SR~~

teeerc e eedcrecureeeequeeee

,

<NOW:STSRC>

-

produ c c COIlo ~ D tlI OrC,Urr!lIt.t=lt.eorlo\lrccacqu cnc cil.c' r:ltinn

<NOW:STOST>

'

"

/ ~t:D"'uCCCOIll.c'D.Uof(urrtolIl;l.l.c'ofdestinati onsPfluc nceh./'f~"

:,MOVE:STSRC> moveto~c.{ltJocatiODill&OIIrctl"llltll Ct

<MOVE:STDST>. mOYclOlltlltlocaliooilldnlio:atioll W'qllCDCC

<CL£~lJP:STSRC> potrformcitao lpoptntKilrrquil'f'dfOf llOllftc M'qucou'

<CLEANUP:STDST> ~Tformtin.•liPoprratioa~lIiri!'dford~!ill:/.tio.Sl'fja"llc.

untoria. 't1

,b<:o-.

~cd« isioCl1.1«in olndilldui...illltbepr0l!.'"m...1..

-npr~lIthl'tile<INIT> "col

-,

illtbe(011'1'1\al,Ofitbm.

" Th~dtcisioolill" olnd:ll'fb:lllk111ytberollowiol "

Ii) Tbetypeor,d:UI'~'''tlVre;dyumic (rulltimeallontioDor 1I0t:lAe)or4h tie

.

"

(compilelime :altoc::atiollorIto r3gr). Thi. inrorm:alinnisdete rmin ed' (romthe

~riPlor.or tbrd:..fa ltructurr l. , ' ,

,

I-T h'y,lOlDwku I;'"I~•••,•.IttJi..."..I.b•••••.I<p .....,.l~"It... ..'...1f...'.'I'~ .d...

d_ rip , or.Sn App••d"C.

--I

\

"J

(46)

·34· ,

(iiI Tb~type ofit~r3.tion:dts truct iye(cbaogemillietotbeYalu ~ssto redor r~preHn tation)~orooodu.tructin.TbisioformaliOIl isdet ermioedfromtb~

t)'flt'ofro..till~:D~struetiy~IAP~END.CONVERT.COPY,.._)orNeqdes- troctiye(E MPT Y.fiND,INDEXOf,RELATio N...I.

(iiil AUribu~wbicb need sllt'ci:l.lcOllsiderat ioll;sb eorbud~ rcell.Tbisioror- meueeisd~tl1 rmill tdfromtbtl!'dllta de. criptor.

TIle decisioDtreesbowDiDFiSUR7'i...sed to gellerat e tbe codefragmellt

~b acollcalellatioll aadselect;~D ProceS! ba.lCd oD tbe pre.~nc~or.ab.ence of

eequired att ributu

i~ropert'iu)

:. Itc:l.1lbeseen by

i~.pectioll

ofFigure 7, tb:ttbe gener:r.tion oftbe coderr:r.gmentfor Ibe <INIT>eveotcall depend 011 tbefollowing :r.ttri butel :

(i) IS2.. t3lie ord yoamie datarepre5Cota tjoo beiogu. ed?

(ii) I. de.t ruct;ye(cbangeofYalu ~sstored IIIrepruent3tioD)ornondeatr uerive ite ratioll being performe'!!

(iiil 1. 3.beaderc~lIplC!CIlt?

d~

'S,3.silepte. ent orm.uuonebewrnputed?

Itnilbe seell by observatio n. tbat evena verysimpleeYeb'tsuchas<I~IT>

(ioilia/il eforittr~tiollovers,eque ncel.·cao ioyolve quite3.few'or tbe:attribute.or tbedat:t.fcpruelll:t.t ioo:lll d tbeabstract algoritbm.

~'.Ull...to" .tn&,,"•••".I""O.,"uut,••

. , ..

(47)

·3:)·

(48)

/ /

' I

Tile t1erivat ioDofthe <INIT SRC~.Dt'ollow.:top:lthu ,bowDio Figur e 7.

?

f\o

fil Ule8 Deriva.l.ioD01the code rn.im eotrrpr eaelltilJ&

<INIT:SRC>enol.ID thecOllverl.a1iorithm

'" .

wh: :lh~",areu~~ula-belatoaid ill tbe expla.aat ioDofthe code deriut;oD pro-

TheduivatiODDCthe code balmeotwhichrepreetDtsthe<INIT: SRC>

ntutIWUat theroot o( the dccilioaweeshown illFila re'S,Dode " o- Theeood i.

tioo kated at Ulcdec:itioonodeItlt>.il whether:tostalk01dro :unicrcprCUlllatioDU

.7 . . '

beilll uKd. Fromthe data dtl crip tor ,it i.dctu m iocdtbat :1.0:lua)'rcprcsclit a tiOD /-

I,"illl \Iud, aDd U lueh,is •Italicrcprucola Uoll.The rilh l.pith (romLbe node

. .

n".i.IIlravcued.

The havcnaJ orthe .i,htpathle:ul.to tl1e cDoulcnalioll ecdenl lpoltorder trucrnlj.Tbe left path ofthe nod eItIittra"er~d1.l d•lufi.met,Attb~ 1~3f

r. . .

1

(49)

-37-

lhecoderr:lgmellt

...

STAnG: -1

,

ilCOUlld.Thedecb iolltree tllr:lYtf6ed upward ulllilthe cOllc:lLeoalioo 1l000e nIis

\ 1

metagaill. T herightpathatihe cOllcate llatiollllode n1 iathell uavereed, Thi: b'a ve rsal01the right pathkacbto thedec~iollnode n2'

" The

cOllditio tl.

tested atthe deciaiollnoden,iawhelher a aileil preaelltor required. Fromthe datadescripto r itiadetermieedtha t no aizeia required a.i:ldt.helen path01the

- .

noden,11tra~erled.Alearia"m et:I.lIdit cOlll aiQIthe emplllcoderragmeotTile empty code(ra gmentiiiu'5edwbee no sta.temen tIlndlto be,coerated.

The decislol:ltree sholYll illFilure 8 reduces to:

Figure0 ReaueeddeClslOOtreetequu ed by «NIT:~iRC >

After the cOllca te oa.tioll

I!.roce~

ud the subst ituti on01the

,tring~SnC~

torthe '

/

"

Itrinl~ARG-, therollowing codelragmeotis gellerat ed:

<INIT:SRC> STSnC:_

\

I

- .

(50)

·38·

?

/I•

...

...u" ...

+ "

Figure10 Deriyationoltbecoderr:l.&meDt repre~nti?.Jr

<INIT: OST>event intbecODvert:J.Igoril~ m The du iu tioll ofthe code,rragmentrepr~eDLiogthe nclll<INIT:OST>

ala l'LSattbetoOtof the decisiontre eShOWD illFir;UIC.l O,·II00C " Do Tbeeooditioll tested al lhedccisiotlnodc node nois'whttherastaticordyumicreprcscotationis beiDgused.From.tbed:i.ta.ducriptoritis deter mined tb:t.l3 ainglylinked list

~( repruflltatioDwithou t:1headercell

is

~hl&usedaadM I\leb,isa d)'ll:1mic d:1ta re,prescnt:J,tloD.The] ehpat hlr.om the ecde"oi, trayefSed,

TbeIravtr n.1o~~ldtpath Ind sto tbe decisiObucde" I' The condition

(51)

r-I-.

)

,,-

If;,tedatthe decisioQnodenil'

WIR~~iVe

(:..

Cb3n~

..m:a,I.. \"th.. valli"

,tored or repre, entation )cr ecndestruceweitentioDisbtoillll perrormed_ .I,'rom

.

th..

parameterspeeilicatioD

or

theCONVERTa,[goritb!Ilitisdel.ermilltdlb31the DST

•para mete!.

~

palIlIed&1'"y\t\;t.ble par:lmderand usuch,m:!.,illvolv..cb:l.f1ge'to th.. values passed, tberdDled~lructiv.. iteratiollis~iD&performed.Theleftpath isltave~edrromthed..c:isioDllodenl'

The.tra versaloftheleftpath leadsto thecOllcaleo3tioDDode ": _Theten patliis-tra.vtrsed:u:ldalearismet~bel..:U'eolltaiDstbecoderr3&ment

NEW(STARG) PREYARG:_NIL

Tbe"decisiolltreeistraversedIlpwa.rd IJlllii thecopca.tena,tionnodeII:ismeta~3in.

The figb,t path oObe cooca-kul ioQpod.. ":istbu tr:!ovenrd.

Tbetra vel'llal

or

tile right path1..3dstotbe cone:1teDatiollecdelis Tbelert patb ia traversedaDd thedeee lceeedeII~i,met, Theconditilltltralrdat tbedeci.

sion nodeII~iawhtber a headercell ia present or nor.From tbe.datadescr~totit isdeteemieedtbat 00 bead erispresent:lD.dtbe le((patbortbedecisionDocieII~i'I traversed.A learismet wbicbcontain'

ARG:_STARG

The decisiontreeis tben travenedupwardue ul tbe ctltlca,trnat iotl ecde

II,

is met apiD and tbe rightpathoftb~;onu trn ationecd eliSistbentraveraed

Tbe traversaloftbe

tll~t

p,atb Ind'to tbe decision

~e

liS'Tbeee ndirion

trstedatthis decisioneode

II,

is whetheriI"sin IS requited orpreseot.From the. dllbdeulip to ritIS detlCtmioedtb t00size;s required,and.~ beright path is traverstd .A lear;smfC. Dnditconh,iostbe emptystatemeot,

. ,

- -j

(52)

-.0-

The deei,i oQtree ahown ioFigure10reduces tothe followillg"

Fil Ure 11 Reduceddeei.ion.treerequiredby<INIT:OST >

Afler the concaLeaatioa proeeueed the .ubatitutioaof tbeatrilll "OST"fortbe atrilll~AHG".the rollowiogcode rraVRelltbleaeraLed:

<INIT:OST> NEW(ST OST);

PREVDST:- NIL;

OST:_STOST;

Thederintio~_,show, bybreakilllthe problem or codeleDeratiollilltO eeeor

" . ~ "

determiaialrequired proptrliu (1II1ri6utt.),~ecode fralm ent3UIIbederivediaa IOliealalId ayltematicmalloer.

..

(53)

·41 ·

7.EmdenC)'orImp le mentation

»pee'"01 a Mlltwa.res,.ltem:du"elopmtll t . C1)rnprebt'Dllbilit,. .nbuilit,..1IIal1lt:ain.

bilit,.udrru.sabi lit,..Howeyrr•.lIIi1l1eoa ua tioaal data abauaclioatrdI D~\I "

I

itill

postible to dr ri'rr

iaemdeat~mpltmutatioDI

(poorpel,;rm3aer ehru Lr,j,lies).

. /

Todrri~eim plemra~.~lItwitb.brtterperformuee (blraetr,i,tiuiIlYo[Y~

optimintiolloperatiool. Thr·reare two places illtbeeTfatio a01 the aoftwa s,.stem (.1

tha~th~r opet atiol1l e:r.lloecur:

Ii) At tbe devrlopmeotpb»r, with~beseleeUoil orell'ieint3110ritlnuaDd reprn ra t:),tioot .

(iii Attile impleVleDta tioDpha.se.b,.makilllcodeoplimila tiposb:lSfdon

nr lelf ralproblrmofcode optimiu t iool is be"olldtbescope oltb:i:!paper.

. . I

boweYrr.tbrimplrmntalioll lel crated b,.theeYeolb»f'<1 trebaiqllem"tbye

..

u".I1";~ ~d

.pu".mpln;''''. .

.1. .

Codroptimll atioa (:to beperformed either maa . all,.eM'alitornatte::tIly

I3.UJa.~.27I.

Both·trehoKi"'' '

lI~aDSlormatioa:tl 111lem

based 00

~~iY:lleO(e

preH " io&traosformaliolls.TIeIr:tDSrOfm~yenio ll!01 theimplrmCDt~aafe

"iinPIOvf'd relatiyetosome mn l llle(timeorIpacel, wbileprnervio&lprn'fa m eerreereees(!'DiDtsorillv,ri:tDcel.Typicaltraosl ormatioaswbieh;a.replrfo rmrd are:eollaplilll01loopl,.simplirl io&s.eleetioo,illlioecodilil 01Iherrp rueotJliooof:l proerdureorfuoel ioo•.brrakillleD C:)'P!lllatioll•..

f.

(54)

Thfproblflll 40tJla iDnd~r':oll5.iduatiolistheutotJla til:Infr:uioQof

I .

!IOfl_arfII)'!lUms~I-Pu.e:IJ_kic:h"pportthfstril'lSof'qQf~f lahltt:ac:tioa,·atil'

Lt,u eOG.idftthPRINT:IJ&orithrn~S&i.rOt(OtJlp lln- bet_ft.Llt.e. eo. yn t jolllJ data.ailltr:ac:tiol:t«baiqU'!l udtlte eyea t·h~ tKhiqu~pr~.ie'd iat bispaper.

The pri o t:lI,oti llt.mis.~to prillttbeCOlteDl3ortheKrial(scqueae e ).

.

'

. ..

-rRbCEDURE PRINT «PARAM>}

BEGIN

<INIT:SRC:>

WRITELN

WHn.ENOT I<EOF:STSRC» DO BEGIN·

WRITE«NOW:STSRC»

<MOVE:STSRC >I

WRITELN END

..

r,

Table8 eODta in.ali! tof~y e .t!iDth~ptiat a1loritblllthat eeed tohegfa•

..

(55)

: 1

Table 8 EVf'Dtsi utbe pTiolalsoritbm' thtoeedtobederived

E'eot DeJ<:riptioo

,

<LOC_YAR> ·focalYaliable'dedaratiODlorabst ract all oriLbm

<INIT;SRC\ ioi t ialil e 50urcelequeoce roriteratioD

<EOr:STSRC> testroreDdOf,soIlTcesequ,eue

<NOW:STSRC> prcdeeeCOllt~IlUortb~urrea Lstat!orsourf'ce1'"Clll tllr~iteTat io o

<MOVE:STSRC> mov~'rooextloe&tiooio Ibe dest illat ionseq uence

Thedata represu t a blionuu d rar the comp:t.risioo i! a !iOl lylinked list wilb I be:t.der cell wbicbcODtaill!a poillterto th,.,IIrot elf'm..nt,a oil "anda pointerto .tb..Ialltelemeo t.Tberollo wiolly p..declarati o o ,slellerated'

TYPE' LINK ...°BO DY;

HEADER_ RECORD

SIZE:INTEGER;

LAST:LINK;

FIRST:LINK END;

BODY- RECORD DATA,;CIIAR;(,daLalleld oJ FWDPTR;L1~(0{orw:t.rd poin te r "' END;

lI't heconvf'otional dataaMtr3elio~"tec hoiquesw..

...

te followf'dl••p:t.r3tionot Impleme e tarioefromne), tbeevents (opeuliooll)shouldbe implemf'o tl'd:loSploredure or lunet iollc :t.l1i, .... intbe rnll ow,4g:

P~~g~~l.:nE

.-

INIT. tSRC:I!EADER; VAR STiRC:LI;-.JK}:

-,

(56)

· H · I

ST SRC:=-SHC .FOlST END;

FUNCTIO NEOF (STSR C:LINK):BOO L~AN;

BEGIN

IF STSRC- NIL THEN EOF :_ TRUE ELSE'

EOP :_FALSE END;

~~g;~ONNOW(STSRC:LINK) c~;

E::g;w:-STSRC'.DATA \

PROCEDURE'MOVE(YAH ST SRC Llr:tt;:

BEGIN,

STS RC:_ STSRC ' .F WDp m . END;

PROCEDURE PRINT(SRC:HEADER);

"YAH STSRC:L1NK;

BEGIN IN IT (SRC,STS R Cj:

WRITELN ;

WHILENOT EOF(ST SRCIDOBEG IN WRITE(NOWfSTSR Cl);

MOVE(ST SRC) END;

WRITELN:

WR ITELN END;

. .

,Theirnplf rnf o tat ioole~er:t.ledby niDIcOllyelltioll:t.] data :t.bstuctioll~cbll iq\l"

bllil:t.l:t.rlfdyo:ltJlie or i'lltercoJofctio ooYerbead (poortime ead spaeeutilizatio o). • Ir tbf eYeD! based tecboiqUfwereused.thecode rralmell tswhich im plement the :t.bstrlldoper:t.tiollStobe perrormedarederivedusill3 adfdu~tionm«buillm(decision

I'~-

Irte~lud are eeded atib~-pointor callusialattrb~i<j,\l"';'alledmodu leexpall~ion 1·1.~1.

Thimplf mea t:t.tioD deriYedisthe rO!lJ.iIlK: --

~

,

(57)

...~.•s-

"'- ,

\

P~~ED~R INTt~RC HEADER);

STSRC:LINK;

BEGIN STSRC:_ SRC.FIRST;

WRtTELN;

WHlLg NOT (STSRC _ NIL) DO BEGIN WRJTE{STSRC'D",,"TA);

Sts RC:_ STSRC'.FWDPTR Er-.'D;~

WRITELN; ~.

WRITELN ...

END;

T,be implemeDQtioDeedeSeDuate.dby

~be eYeD~

b:.sed tecbo;quewu,lolilld

i~&eDeral

to rll~lirty percent ru ttrtha D tileimple~eO l:1~ioll'c~eleDeratedbyeee ve nuc e stdata

, . .. .

:1bstracti olite<:boiqllt5.'t~1'iiij)i;-n\eot3lioll.code&ell.e;3tedb'tlte neotb;l.';~tech nique

.

'

. .

did DOtbve the brl e comm., oiu tioD oyerbe:MI:woc:b tt'd...ilbtheeede~ener3tedI1l!j o", tbeconveotiooa l d3b , b!tr 3(t iolluchoiq llt5. •

~

AllMlumelll::l1:Noll Ibe aboveslaume oti!l"bat'ill s.,cb ::lsimp le~~a pros r:uo- merwhoWiLfim plemeoli olthepriot:all uri tbm wou ld11Kllle nme implemn l :atioo.

Howeyer,itmustbe remembertd tba t~Ile :a.b" rac~..ope raton are10beuwdtllf~ .II~Of.l.

thesort"::l~syllum nd u sucb_OIIId.be im plellWllte-dlISillltile ructioll:1odprl'lO:,.q.r~

. .

mffbal .lt iOl iO l,heIU lf dYll:amicor commllt lo1'er be:ut.Th er e3repu~_.,j·

blymort iud ollsthat cOllldbeperformed01theImplf lllf'llb tio l-derivedbylilf

\ e1'eot,b boiqoe;!lo" e1'er.tilt

c~e

If Deratedmel lheoptt a l.aouJrequlrfmeou,It ,... did1I0t...:uteexcnsj\le:amoulsofspxe

a:

time(ru .aon bly tllicifllt )ndb:ut::all.,r llle

"'--:~t:'I" or

the code Ifrlerat rdby

tbe COnYfntiOll~\techniquu.

.

/ ., ... "<, .

'\

. ,1

. ,

\

I

;- - •

(58)

, ,

8.ImplementatIonExample. •

"

/

implf'mf'otedbyderivillclbtcoderraltlleDt3reprtsutioltb e abstract oper 'olls io¥oked by thn~llla.Thec~e ~a&mcot.arcIb!Dsu bllt ltu ted ialioc-iorthent llt .xCIII Ice.in tbe;wstract3lsorit bm.

T h e

reseu istheirnplemelltatioGoftbea~tra(t';ugOrithm II aparliculardat:irep~lItatioo .

Tbl~Il!ctiollwillshowtbtleDCratiollortheimplefleuatioll codereptheo tiogthe aln.\ra:t

~r,oritbms: CONVER~.

Irt;ERT aDdRELATION,IIsiDCnrious datarepluton - lal iolll .

T~ecooyer!aJloritbrnbas beeniolfoduced.iD~rCYiO\l,5settlOD!as ameansor show.

illlbowtheevenl beeed~Cb Diquuwlll.k'tTbis s«tiODwiB sbowtbe glnera tlonorimple-

, ,

meolatiolll orthe; ODHrtallo rith'!lusiol variollsd at:l.le preseola lions

'FbeCODvertali orithmtsesedf,2-eeeverrrr em~.erepro/at:lt;oil..I(~OtmCE.SRC) t..anotber(DESTINAT ION . OST).

.

Tbe(OD.."vertal&q,itb m;! tbe, rollowia&,~ :

....PRO CEDURE CONVERT« PARMA'>)

<eOC _VAH>

BEGIN

<I~IT SRC>

~<INIT DST >·

~

WJ-m.E NOTI<EOF:5TS RC> "j DO BECIN .•<NOW:ST0 5T >:_<.N~W:STSRC>

<MOyE:STS RC>

I

'I'

I

(59)

·47·

<MOVE:STDST>

El''D

<CLEAl\I1JP:STSRC>

\

< CLEANUP:STDST>.~

END \../

nhle.9coohiblthe listcreveeuin 'the convert !Igorithm lblOffd theircede

TableII £velllsill the conveUallorithm thatoctdtobedcrived

Event

.

Dc!tCriptioo

<PARAM> par:ameterd ~l:uati.oll,rorab.tractaJgorilbm

<l.OC _VAR > local.vari:lblededaratioD for:lhstr~l:llloritbm

<INIT:SRC> iDitialize~urce Sfqucnceroriler:llioo

<INIT;DST>

;;ili'I;" ~li"li"

..q'''''I'';I'''li'"

<EO F:STS RC > teerrere ersccree seqeeece t ,.-.

<NO W:STS RC> producec oottCIls ofcurreol . tate of sollrcc M:qllcnccjit..r:l.li" n.

<NOW:!TDST> p.roduce cODtcDlso rc urrCll15 1:l.teor dc. linationi~lIcncc iU'u.~

hOD .~\

\

<MOVE STS RC> movetollcxtloc:atiooiosolllce sequcocc

<, - --

<MOVE STDST> move'toeextloc:alioDio~desliDt.tioD M:qll ence

<CLEANUP~TSRC> pcdormdeaDupoperationrcqulred for ecureeeequeuee

<CLEANUP:STDST> ~rrormcleaD llpo~ratloDrcqllitcd.rordC1till:l.tioo"''1l1fnCe

, \ '

...

(60)

·48 ·

/"

.

DO headercelltoadoubJrliokedtiD,witha beaderfelltb al f ol ta illS lhefoltowiogillf or·

malioll:OrBt (poiotertoOralfell),lut (pointertolu t fell)anda5ize('numberofitems iD theriog).

Thedia,ramshowoin Figure12 shows3simple example:

FRONT

Figure 12 Cooyefllioll-lromasinlly linkedlist toadoublrlinhd list ...

WhueFRONT il a poil)tcttothe OrstelcmeothitheSiOl irlinked list eed liEADERIIa recordwbk:hcoot:a.in:palou!tolhe Orstelement,pointertolb~'tele-

. '

meotaod••ue orthedoublrlioked rio,.

,

(61)

. -- --

Th~followin, ty pededar;ation m"ustbe,en..rat~d TYPE

LINK _ "BODY BODY _ RECORD

DATA:CJ-Wl; (0data6tldoj FWDPTR:LINK(0ro rwardpoiatee0' END:

LINK:! _ "BODY:!: I

HEADER2 "'" RECO RD

SIZE2:INTEGER;10aile Geldo}

LAST2:LINK:!;

to

pointtr to l:L5t0) FIRST:!:LINK:!

r-

pointertollr~toJ END;

BODY2_ RECORD

DATA:!:CHAR: 10data Beldoj FWDPTR2: LINK2;(0for....ardpoiou roj .: E~~TR2:LINK:!(~backwa.rdpoiutt r

°t

t

maDntrd~5cri bcdioScctioD6.0"Usio,a d« isioDtreestruct ure,determine the;aU'i bu~e"

th;atbol dfor the,ive Ddat a...,prest ota tion;andlup po rt t hu~;attrib uteshYll'oerat ioltI,,, cod e fr3sm eo15 tope r formtb~requiredabstu.d operations .

The~odefta lm eotl seQerated forthe(ODvu ta110ritb~u8iDI\~,~yIipktdlis t re prmo ta t ioDISRC) eed~dou blyllakedriol repr e!oeobtioolOST)aretheJ ollowillA:

<PARAM>

~ snc;

LINI<:VAll.OS;:;Pf'.:K:! I

VAn I:INT E GER;

STSRC:LINK;

PREVOST,5TDST.UNI\~;

-cuur sac» 5TSRC:- SRC;

Références

Documents relatifs

Cette clé utilise le nombre de soies prémandibulaires pour différencier deux des trois espèces potentiellement présentes sur les deux îles, avec pour S.. Les

Face à cette situation, les personnes noires sont obligées tout à la fois d’adopter un pro- fil bas pour éviter les ennuis et de préserver leur dignité notamment par un mode de

On apprit alors avec stupeur è la fois que les travaux avaieiit englouti une dépense de 167 millions; que les per- spectives de trafic s’étaient évanouies;

[r]

[r]

Ð lecture d’une fiche technique Ð lecture d’une phrase du livre Ð détacher le mot Ulysse. Ð retrouver un mot dans

[r]

For extending screening and health surveillance to c o m i t i e s a new way of thinking about health care is needed by both health personnel and thc public, i.e, there