13.07.2015 Views

The PowerPC 604 RISC Microprocessor - eisber.net

The PowerPC 604 RISC Microprocessor - eisber.net

The PowerPC 604 RISC Microprocessor - eisber.net

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

56 Pascal Implementallon:Comildler and Assembler/Interpreter3385 storeosttol genujpxjp(57("ujp 0.),Iaddi,, putlabel(lcix);3386 lc 8- 11c;3387 end ("forstatement")3388338933903391339233933394339533963397339833993400340134023403340434033406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343134363439344034413442344334443445344634473448procedure withetatement;var lcp; ctp; lcnth di.prangel 11c; addrrangelbegin lcntl 01 11c ► .. lc;repeatif ey ident thenbegin searchid((vers,field1,1cp), ineymbol endelse begin error(2); lcp uvarptr end;selector(feys + (comma,dosyhicp);if gottr.typtr nil thenif gattr.typtr ^ .form . records thenif top < dieplimit thenbegin top t. top + I; 'encl. ► - Icnti + I;with displayttopi dobegin [name J. gattr.typtr"ofstfld;[label t.■ nilend;if gattr.accees drat thenwith displayltopl dobegin occur t• creel cloy I. gettroilevellcdspl t. gattr.dplmtendelsebegin ioadaddreae;elign(nilptr,1c);gen2t(56(Aetr*),0,1colilptr);with displeyttopi dobegin occur 1. vroc; vdapl t- lc end;lc 1. iciptrsire;if lc > lcmax then lcmax lcendandelse error(250)else error(140);cost ► - ey comma;if not test then ineymboluntil teat;if ey doey then ineymbol else error(S4);statemont(feye);top 1.. top-lentil lc ► - lie;end ("withetstement") 1begin (*statement")if sy ■ Intconst then ("label.")begin lip t ■ displayllevel).flabel;while lip 0 nil do.4ith Ilp" doif labval val8ival thenbegin if defined then error(165);putiebel(labneme); defined true;goto 1endelee Ilp nextleb;error(167);1 ineymbol; 1if ey • colon then ineymbol ales erTor(5)end;it not (ey in fey. (identl) thenbegin ercor(6); skip(feys) end;if sy in statbegoys + (identl then3449345034513452345334543453345634573458345934603461346234631464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512Compiler Listing 57oggincase toy ofidentt begin senrchid((vsrs,fleld,func,procl,lcp), ineymbol;if Icr.klass proc than call(fsys,lep)sloe aesignment(Icp)end;begineyt begin ineymbol; compoundatatement end;gotoeyt begin ineymbol; gotostatemant end;ifsy ► begin ineymbol; lfatatement end;casesyt • begin ineymbol; cesoetatement end;whilesy: begin ineymbol; whileetstement end;ropeateyi begin ineymbol; repeststatement end;foray ► begin ineymbol; forstatement end;withoyf begin ineymbol; withatatoment endend;if not (ey in (semicolon.endsy,elsosy,untilay1) thenbegin error(6); skip(fays) andendend ("statement") 1begin (*body")if fprocp 0 nil then ontname fprocr.pfnemeelse genlabel(entnemo);cetptrix is 01 topnew t- lcaftormarketeck; topmox i ■ Icaftermarkstack;putlabel(entname); genlsbel(segelze); geniebel(stacktop),gencupent(32("entl"),I,segeize); gencupent(32(Aent2"),2,stacktop),if fprocp nil then ("copy multiple values into local cells")begin licl t• Icaftermarketack;lcp 1- fprocp".next;while lcp nil dowith lcp" dobeginalign(parmptr,11c1)1if Ideas • vats thenIf idtyps nil thenif idtype.form > power thenbeginit vkind . actual thenbegingen2(50("Ide"),0,veddr);gen2t(5 4 ("lod"),0,11c1,nflptr) ;4 0("mov"),Idtype".elte);gen1(end;licl 1- 11c1 + ptrsleeendelse licl 1. llcl + idtype.site;lcp ► . Icp".next;end;end;lcmax lc;repeatrepeat statement(fsys + Isemicolon,endey1)until not (ay in statbegsys);teat t. sy 0 semicolon;if not test then ineymboluntil test;if ey • endsy then ineymbol else error(13)1Ilp t. display(topkflabol; ("test for undefined labels")while lip nil dowith 11p ^ dobeginif not defined thanbegin error(168);writeln(output); writeln(output,' label ',Libya!).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!