CedarLanguageOverviewVersion4.2Releaseas[Indigo]Documentation>Overview.tioga,.pressCamefrom[Indigo]Manual>Overview.tioga,.pressLasteditedbyHorningonJune1,19836:48pmAbstract:ThisOverviewisintendedtointroduceyoutothebasicvocabularyandconceptsthatyouneedbeforeplungingintosourcesofmoredetailedinformationabouttheCedarLanguage.ItassumesthatyouhavealreadyreadtheBriefingBlurbandtheIntroductiontoCedar.Ifyouhaven't,readthemfirstandreturn.ItstartswithabriefreviewofthecommonconceptsthatCedarshareswithothermembersofthePascalfamily,thengivesasomewhatlesshastytourofthemorenovelfeaturesofMesa,followedbyadiscussionoftheadditionalchangesthatproducedCedar.Finally,thereisaguidetosourcesoffurtherinformation.Version4.2oftheCedarlanguagedocumentationcorrespondstoRelease4.2oftheCedarsystem.ItisintendedtosupersedealldescriptionspriortoJune1983.Previousdocumentsmaybereadforhistoricalinterest,butarebelievedonlyatthereader'speril.[Ifyouarereadingthisdocumenton-line,IsuggestthatyouusetheTiogaLevelsandLinesmenustoinitiallybrowsethetopfewlevelsofitsstructurebeforereadingitstraightthrough.]XEROXXeroxCorporationPaloAltoResearchCenter3333CoyoteHillRoadPaloAlto,California94304DRAFTForInternalXeroxUseOnlyDRAFTpî ìï^kî•î!õqî ìïYnîrî ìïTqîosî¬ïTqð,î0¸rî ìïRÈî Lsî¬ïRÈð)î.érî ìïQî �sî¬ïQî³îWî~î(î Õî$sî'­tî ìïJwsî=ïJwîïJwîsî×î^î"uî$3î*Ïî-¡î/_î1ãî5È î=Kî@2îF—î ìïHÏî Ìîˆî7î]îSî#õî%Áî)”î/5 î7î;>î=ÑîB=tî ìïG(î cî,î|î‰îgî"?î%ñî(²î.Öî3Bî6[î9 îBbîD;î ìïE�î WîYî”î;î:îžî"«sî( ïE�î(nïE�î)?î-+î0/î1Yî4Ÿî9%î:Èî=2îC$î ìïCÙî î‰îqî¶î¶î$Aî&&î(Ðî-¸î2~î5úî9ðî;[îB€îE¤î ìïB2î îÌîXî#îîÖî ›î$ëî*Òî,Úî.& î5yî7?î9Ê î@™îF—î ìï@‹î™î`îjî>îËî!î%-î&ñî,Šî.Nî3 î ìï=7î‘îHîOîîÃî"| î,Ý î5²î7¹î= î@WîB^îE+î ìï;�îGî î1îRîî!Nî#M î+¬î/8î0ÿî4­î8±î>ÇîFjî ìï9èî îoî· îîÅî Zî"ïî(Êî+úî-³î0=î6tî ìï6”î î@î&î$îbî# î(ÿî*î07î3¡î6Éî9çî<ÂîA4îFaî ìï4íîzîïî îî"'î%)î(,î+†î0lî2ˆî5îhîB9îEDîF^î ìïV­ îÔ î ®ïT/îŸîSîÄîˆ î"®î(¼î*²î-Zî2uî8 î;lîA§ îGRî ®ïR‡ îPî.î® î&¹î,Þî/¼î6îC{î ®ïPàîVîùî£îoî!i î'¯î)î+´î0¤î6Pî8ø îA;îBÚîE*î ®ïO9îrîž î Iî&|î(¯î-î3«î8Hî>qîATîG\î ®ïM‘ î]î$î�îú î(áî+Pî.Ýî3« î\îA¥îBÑîEtîG/î ®ïFîî3îcîWî�î%4î'·î)í î2m î;F îCòîEüî ®ïDv î`î(îdîÆî$éî'Ñî+Øî1î6\î9Ôî>vîDÝî ®ïBÏ îWîï î ›î#P î(±î*ìî0mî2Ëî7ßî9•î<£ îDƒî ®ïA( î/î î!Øî#†î'sî ®ï>ªîî€î3î7î -î&Ÿî(î/ î7<î93î;Úî?” îFØî ìï=î«î�îîîtî$^î'Zî,Rî..î1åî7@ î>îîBôîEwî ìï;[î�îîPîîÔî “î$&î'Äî-Šî/7î1–î5¹yî:Sï;[î:×ï;[î;Ôî>¶îD îFîî ìï9´î ,îî#î‘îâî ½î#mî%Ü î-Ìî/•î3ÿî5†î87î=[î@zîCüîFïî ìï8 vî ®ï5ŽîùîTîîfîÁî"Dî&Ûî(Åî+Vî18î7î:î>OîB£îEðî ìï3çîÓî�îÕîíî~î˜î"ÿî$î*î- î0’î3€î5.î7‚î; î>¾îCàîE�î ìï2@î‡îyî™ îîÂî î#…î(¨î+mî1ƒî5êî7Wî:‰î=›î>»îC îD»î ìï0˜î )îÒ î ®ï.î¸îÑîñîWî Rî"¢î&]î)î,Rî-ðî2÷î6eî:mî@ÈîC î ìï,sî TîZî>î²îaî!ëî$h î+Kî-õî1³î4rî8Pî=Mî?îAÄîFHî ìï*Ìî î ” îÊîßîñ î$•î'Fî-4î/åî2–î7 î:Lî;oî>ÛîAÎîC�îFØî ìï)%î :îÙîŸîŽî—îÜî$Öî&uî+Oî/§î5~î7Ïî:Ù îAÑîEvî ìï'}î ºîqîíîî¶îl î ®ï$ÿîò î…îîëî$óî,î.ô î6Sî8†î;·î=:î?òîBîEüî ìï#XîîNîùî�î)î¡î#»î%Ýî(óî* î0 î5§î7Qî;,î=‡ îE{îG/î ìï!±îÐî îsî§î{ î%Uî((î,¿î/Pî2eî5Çî9¸î;‚î=™î?„îC_îFØî ìï î ‹îmî ®ï‹îÒîÿîÅ î"jî$2î)î3…î6ûî=ðîAEîFHî ìïäî Rîîøî2îéî-î qî#´î&øî*Öî-–î2´yî4Iïäî5<ïäî9\î;¢î=Xî?¿îCÊî ìï= î î”î<î!@î#lî% î'Wî+Hî0 î1zî2àî8Rî9úî@îB î ìï•î Sîîî)îÍî"¦î%Ÿî'…î* î,Ý î2ðî8Gî:¼î=&îBhîEwîG0î ìïîîvîqïîîXïîîîœîî!Vî'Hî)7î+×î1Éî5´î8_î='î>ÔîEî ìïGî ëîŠîGî…îîäîRî#Ðî'%î*‘ î1#î4™î:7 îA�îD¸îEñî ìïŸî÷î°îMîîîwî&Žïûî+ ÿ ßTVm$éCEDARLANGUAGEOVERVIEW4ReviewofthePascal-likefeaturesThefollowingsummarizesaspectsofCedar(andMesa)thatarebasicallysimilartothoseofothermembersofthe"Pascalfamily"oflanguages(e.g.,Euclid,Modula,Ada).Ifthereareanyconceptsinthissectionthatarenotalreadyfamiliartoyou,youshouldprobablyfindaPascaltextbookandstudyitbeforeproceedingtofurthermaterialonCedar.(Youwillfindthatthenamesfortheseconceptsvarysomewhatfromlanguagetolanguage.)Analgorithmorcomputerprogramconsistsoftwoessentialparts,adescriptionofactionsthataretobeperformed,andadescriptionofthedatathataremanipulatedbytheseactions.Actionsaredescribedbystatements,anddataaredescribedbytypedefinitions.DataandtypesDataarerepresentedbyvalues.Valuesareimmutable;theyarenotchangedbycomputation.Aconstantalwaysdenotesthesamevaluewithinascope.Avariableisavaluethatmaycontainanothervalue;assignmentchangesthevaluecontainedbyavariable,butnotthevaluethatisthevariable.Avalueusedinaprogrammayberepresentedbyaliteralconstant,thenameofaconstantorvariable,orbyanexpression,whichwillitselfcontainothervalues.Everynameoccurringintheprogrammustbeintroducedbyadeclaration.Adeclarationassociateswithanamebothadatatypeandaconstantvalue(whichmayitselfbeavariable,andcontaindifferentvaluesatdifferenttimes).Adatatypedefinesbothasetofvaluesandtheactionsthatmaybeperformedonelementsofthatset.Itmayeitherbedirectlydescribedinadeclarationthatusesit,oritmaybereferencedbyatypename,introducedinatypedeclaration.Thetypeofeveryconstant,variable,andexpressioncanbededucedfromstaticanalysis.Thisanalysisisperformedbythecompilertoensurethatallprogramsaretype-correct;thusthelanguageissaidtobestronglytyped.Anenumeratedtypedefinitionindicatesanorderedsetofvalues,i.e.,introducesnamesstandingforeachvalueintheset.Thesimpletypesaretheenumeratedtypes,thesubrangetypes,andthebuilt-intypes,includingBOOL,INT,REAL,andCHAR.Therearestandarddenotationsforliteralconstantsofthebuilt-intypes:TRUEandFALSEforBOOL,numbersforINTanditssubrangesandforREAL,quotationsforCHAR.Numbersandquotationsaresyntacticallydistinctfromnamesasarethe"reservedwords"ofthelanguage.ThesetofvaluesoftypeCHARisan8-bitvariantoftheASCIIcharactercodes.Atypemaybedefinedasasubrangeofasimpletypebyindicatingthesmallestandlargestvalueofthesubrange.Structuredtypesaredefinedbydescribingthetypesoftheircomponents,andindicatingastructuringmethod:ARRAYorRECORD.Thesedifferinthemechanismforselectingacomponentofavalue.Inanarraystructure,allcomponentsareofthesametype.Acomponentisselectedbyacomputableselector,orindex.Theindextype,whichmustbesimple,isindicatedinthearraytypedefinition.Itisusuallyaprogrammer-definedenumeratedtype,orasubrangeofINT.Givenavalueoftheindextype,anarrayselectoryieldsavalueofthecomponenttype.Everyarraystructurevaluecanthereforeberegardedasamappingoftheindextypeintothecomponenttype.Inarecordstructure,thecomponents(calledfields)arenotnecessarilyofthesametype.Inorderthatthetypeofaselectedcomponentbeevidentfromtheprogramtext(withoutexecutingtheprogram),arecordselectorisnotacomputablevalue,butmustinsteadbeanameuniquelydenotingthecomponenttobeselected.Arecordtypemaybespecifiedasconsistingofseveralvariants.Thisallowsdifferentrecordvaluesofthesametypetohavestructuresthatdifferinthenumberofcomponents,theirtypes,ortheirnames.Thevariantdescribingaparticularvalueisindicatedbyaspecialfield,calleditstag.VariantsofatypeCEDAR4.2vî;ïgwî 9ïgî òïgvî$Rïgwî%:ïgvî,ïgwî-+ïgsîHDïgxî ìï^õîŽî’îj îÉvî ®ï[¦î”îµ î8î!îî#¶î'Ýî+î/Mî2*î4Œî:*î>¾î@{îD(îEðî ìïYÿîñî¼î.îîîæî&Cî)±î.vî4 î7éî9~î=î?îB3îGáî ìïXWî ™îAîîyîùîØî#î$½î'×î*šî/!î4þî7÷î9,î=[îCîEÙî ìïV°î @î� î�îJîðî"Fî$Jî(¸î,>î.çî1Ôî4 zî6þïV°î7¼ïV°vî;$ïV°î;�ïV°î=_î@çîF€î ìïU îXî¿î…î3 î ®ïR�î îRîîSî"êî'óî)µî,jî1ìî5µî6è î>zî?ÅïR�î@uïR�vîDdïR�îDÓïR�îG;î ìïPæî Úî îfî]îÆ î!î#zî%°ïPæî&`ïPævî(õïPæî)dïPæî,î.– î6Äî9î<ÈîAüîG;î ìïO?îzîïO?î—ïO?vî&ïO?îïO?îºî¿î!î'=zî)9ïO?î)©ïO?î, vî2#ïO?yî ìïKðî ^îþvî ®ïH î6î´ îJzîqïH î ïH vîûïH î!ïH î%¨zî('ïH î(ŠïH vî/kïH î/ÙïH î2¦î5$î7Äî=_î?… îHzî ìïFùvî_ïFùîïFùîÕîòîcîòî"­î'î(?î,szî.ïFùî.¬ïFùvî39ïFùî3œïFùî4¶î5ñî9­î<Œzî?¢ïFùî@=ïFùvîD„ïFùîE)ïFùî ìïERî î îLî¬î Vî&¡î(�î)Æî/Uî1Öî4Kî6«î:Tî=#ïDèþczî=#ïERî=†ïDèþ„î=†ïERvî>ŽïERî@îî ®ïBÖîaî2î–îkî¼îrî!�î#µ î+Gî-jzî.»ïBÖî/ïBÖî2Ðvî7­ïBÖî8±ïBÖzî;8ïBÖî;öïBÖvî?ïBÖî?¿ïBÖî@äîB5îGËî ìïA/îjîîzîçïA/î‚ïA/vîóïA/î¿ïA/î¼î"Vî%¡î*pî-þî2rî6Xî:î@îA²îDî ìï?ˆî <î îîîÒzîäï?ˆî”ï?ˆ vîTï?ˆî ï?ˆî!� î(† î.˜î1›î2¬î6Tî9xî:Šî=wî@oîCîD î ìï=àî –îî!î}înî˜î!&zî#Þï=àî$yï=àvî(®ï=àî)uï=àî.Tî2‚î4î9Àî ®ï;ezî7ï;eîçï;eî9vîï;eîâï;eîÕîî4îNî!î%.î'âî*>î.×î1¢î4¢î6�î=Pî?SîE îFÁî ìï9¾î qî ùîî î îî"Nî$ î%G î,iî/Hî2Rî4î5æî7Mî:aî|ï-Vî?Oï-VvîA•ï-VîB~ï-V î ìï+¯wî =ï+¯î ï+¯vî–ï+¯î†ï+¯î¦îr î @î"§ î*sî/\î2×î9¹î”îDÒî ìï*î ¥îî"îúîîÐîþî ·wî#Çï*î$’ï*vî'‰ï*î'ìï*î(õî*åî.,î2Éî4‚î6áî;;îA#î ®ï'ŒîEî_înîiîtî,zîaï'Œîåï'Œvî$ï'Œî$Ûï'Œî%ãî'î+‡î.¡î0§ î7î9}î>¿îA€îEåî ìï%åî ¥îzî ®ï#j îAvî–ï#jî;ï#jîÔî¾î¥ î&(î(rî+ñî-”î0Æ î8µî;W îA£zîB·ï#jîC;ï#j î ìï!Âwî(ï!Âîüï!Âvî´ï!Âîoï!Âwîxï!ÂîLï!Âvîfï!ÂîBï!ÂîDî#î$½î'î.Oî0Œî6&î7Pî>xî@1îA[î ®ïGîjzîHïGîøïGîÈvîäïGî®ïGî‹ î#%î%eî' î)Xî,Ãî0î1‘î8¦î9ÿî?îAîB î ìïŸîOzîïŸî€ïŸvîQïŸî7ïŸîîïîbî#zî&íî(èî-°î/&î5%î6Ýî9Gî<Úî?ô îF¡îH#î ìïøî£îÑî­ î$<î'©î)qî*Ÿî0€wî2=ïøî2§ïøvî4Iïøî5)ïøî9[î:‰î>7î?ôîBXîF'î ìïQzî ïQî ¶ïQîÁvîËïQî|ïQîàî3îîçî"pî)Àî-Qî1pî5!î;î>ÙîAŽîGžî ìï©î¨îVîî;îôîSî î#.î&î(fî/Žî ®ï.î�zîÌï.îPï.îvîï.î ï.î€ î$>zî(Âï.î)1ï.vî+Æï.î,×ï.î/=î1Ä î8±î:|î<îî@~îCøîEÚî ìï‡î ¨îöîôî›î³îÎî äî"Ãî'�î*åî-2î2¯î5Uî:Èî@áîC/î ìïßî ûî/îîdî¾îÍ î 'î$î&tî)Áî.Yî0.î1=î4áî:‚î@#îBgî ìï8î šî ‹î ®ï½î<î�îŸî¥î—î Uî" î(\î*zî.©ï½î/Dï½vî3@ï½î4ï½î79î;hîAîEaî ìï î œî òîgîmîîP îˆî"Nî&î'´î* î/.î0Þ î8Úî<î?ûîA¶îDóî ìï nî Æîe îÿî+ îcî#î$|î*rî,oî-›î2î5£î9�zî;yï nî;êï nvî=Jï nî>(ï nîC˜îESîFwî&Žïûî+ ÿ ÷TVm$¢CEDARLANGUAGEOVERVIEW5mayalsosharefieldsinadditiontothetag.Anexplicitvariabledeclarationassociatesanameandastaticvariable;thenameisusedtodenotethevariableinexpressions.Dynamicvariablesaregeneratedbyaspecialprocedure(NEW)thatyieldsapointerorreferencevaluethatsubsequentlyservesinplaceofanametorefertothevariable.Finitegraphsintheirfullgeneralitymayberepresentedusingpointersorreferences.StatementsThesimpleststatementistheassignmentstatement.Itspecifiesthatanewlycomputedvaluebeassignedtoavariable(oracomponentofavariable).Thevalueisobtainedbyevaluatinganexpression.Expressionsconsistofvariables,constants,operators,andprocedurevaluesoperatingonargumentstoproducenewvalues.Constantsareliteralordeclared;variablesandproceduresarebuilt-inordeclared;thesetofoperatorsisdefinedwithinthelanguage,andincludesoperatorsforarithmetic,comparison,andlogicaloperations.Theprocedurestatementcausestheapplication(invocation,call)ofadesignatedprocedurevaluetothevaluesofitsarguments(actualparameters).Basicstatementsarethecomponentsofstructuredstatements,whichspecifysequential,selective,orrepeatedexecutionoftheircomponents.Sequentialexecutionofasequenceofstatementsisspecifiedbyseparatingthembysemicolons;conditionalorselectiveexecutionbytheifstatementandtheselectstatement;andrepeatedexecutionbyloopstatements.Ablockcanbeusedtoassociatedeclarationswithstatements.Thenamessodeclaredhavesignificanceonlywithintheblock.Hence,theblockisthescopeofthesenames,andtheyaresaidtobelocaltotheblock.Sinceablockmayappearasastatement,scopesmaybenested.Ablockcanbethebodyofaprocedurevalue.Aprocedurehasafixednumberofparameters,eachofwhichisdenotedwithintheprocedurebyanamecalledtheformalparameter.Actualargumentvaluesaresuppliedforparametersateachapplication.Proceduresmayalsohaveresults;applicationsofsuchproceduresmayappearwithinexpressions.CEDAR4.2vî;ïgwî 9ïgî òïgvî$Rïgwî%:ïgvî,ïgwî-+ïgsîHDïgvî ìï_/î ðî¼î[îî¾î,îÛî":î ®ï\©îîÜî î , î&Yî'†î+Jî.zî/2ï\©î/¶ï\©vî2Íï\©î3}ï\©î8�î:äî>§î@îCVîEî ìï[î Sî’îH zîäï[î÷ï[vî ¬ï[î!\ï[î&oî(Êî/î1!î2Rî6Öî=awî=Úï[î>Âï[vî@–ï[îA›ï[îDrîHezî ìïYZvî¤ïYZî_ïYZzî‰ïYZî ïYZvîkïYZîïYZî6î& î%„î)²î+‚î/8î1î2^î6?î8î;�î=Qî?ÒîE‚î ìïW³î]î îRîÜ î2î6î!& î(‘î,:î1ˆî3K yî ìïTU vî ®ïP÷î±î5î—î.zî¹ïP÷î jïP÷î&Ôvî,cïP÷î-kïP÷î/î4³î7­î9î=0îCÉîGžî ìïOPî_îî+î[î’î¶î!Øî#‹î$® î*¯î-�î1%î2‹î85î:+ î@½zîB§ïOPîCBïOPvîH³ïOPî ìïM© î†îîñ î î$† î+î-Ôî4rî8¼î>öîAîGàî ìïLîFî4îºîîdî#Pî%î+î0Îî3† î:Žî<âîAÌîC‘î ìïJZî fî�zîpïJZî ïJZvîhïJZîËïJZîîîî!gî#áî*î,ëî2iî8Œî:ã îAØ î ìïH³î £îý î ®ïF,zîŠïF,î:ïF,î¹vîÑïF,îlïF,î zî"sïF,î##ïF, vî)`ïF,î)ÚïF, î0äî3ìî5ªî6Ø î=«îD3îGàî ìïD…î Kîyî2zî ïD…î½ïD…vî—ïD…îïD…î î ®ïAÿîD îîVî¸ î#gzî%#ïAÿî%§ïAÿî+w vî1ŠïAÿî2jïAÿî6zî; îA÷ îGËî ìï@Wî}î¨îWî” î"Ž î)Iî/tî1#î2Cî8!î9Ð î@€îAáîG“î ìï>° î°îoî¡ îL î%ªî'¤î-Tî3Àî5òzî8ˆï>°î8ëï>°î:vî@_ï>°îAï>°îCLzîEâï>°îFgï>°î ìï= vîyï= îï= î0îÌîzî üï= î!`ï= î#õ vî* ï= î ®ï:‚zîï:‚îÅï:‚vî˜ï:‚î3ï:‚îþîÉîßîgîç î'Wî*L î17î3êî8î9¦î?îB% î ìï8Ûî îFî¤î¹î`î¾î"|î#åzî&Cï8Ûî&Çï8Ûvî)àï8Ûî*›ï8Ûî+—î/î3¸î6nî9|î;Íî>£î@PzîB?ï8ÛîB¢ï8ÛvîEƒï8ÛîEòï8ÛîG/î ìï74îî¹îâî¢î¦î-îÛî! î'“î+âî.æî0×î ®ï4­î;îüî‰î{zîÜï4­îŒï4­vîï4­îÓï4­îÒzîýï4­î­ï4­î%)vî(/ï4­î) ï4­î*šî1î3•î4Àî8>î=lzî?&ï4­î?×ï4­vîE€ï4­îF^ï4­î ìï3î •î“îîî,îaî°î##î%î&(î)Øî-¿zî0ï3î0}ï3î4Pvî:%ï3î:ñï3î?GîEaî ìï1_î ?îÐî îî¬îÝ î ®ï.Ø î¿îÃî�zîÖï.Øî[ï.Øvî!Œï.Øî"1ï.Ø î)"î*Ûî. î5î8î<žî@ã wî&Žïûî+ ÿTVm$äCEDARLANGUAGEOVERVIEW6FromPascaltoMesaMesaextendedPascalinanumberofdirectionsintendedtomakeitmoreeffectiveforthedevelopmentoflargesystems.StudentsofprogramminglanguageswilldiscerninfluencesfromAlgol68,BCPL,andseveralothersystemimplementationlanguages.Itisalargerlanguage,andisrathermoredifficulttomasterinitsentirety,thanPascal.Itisintendedforprofessionalprogrammers,notforbeginningstudents.Mesamodulesareseparatelycompiledprogramunits,withtype-checkingpreservedacrossmoduleboundaries.Mesaprovidesmechanismsforsystematichandlingofexceptions,processesandmonitors,proceduresasfirst-classvaluesthatcanbeassignedtovariables,andafairnumberofsyntacticandsemanticamenitiesintendedtomakeprogrammingmoreconvenient.Thefollowingsectionsintroduceeachofthemajorconceptualextensions,butdonotexplainthemingreatdepth.See[Geschke,etal.]foramoreextensiverationale,andCSL-79-3forfulldetails.ModulesMesamodulesarea"programminginthelarge"mechanismforpartitioningasystemintomanageableunits.Theycanbeusedtoencapsulateabstractions,toprovideadegreeofprotection,andtoenforce"informationhiding."Theyarealsotheunitsofseparatecompilation.Therearetwokindsofmodules:DEFINITIONSmodules,whichdefineinterfaces,andPROGRAMmodules,whichcontaintheexecutablecodetoimplementtheseinterfaces.Definitions(ordefs)modulesdefineinterfacestoabstractions.Theytypicallydeclaresomesharedtypes,usefulconstants,andthedomainsandrangesofasetofprocedurenames.Theycompileintosymboltables,whicharesharedbybothclientsandimplementations.Checksareperformedwhenmodulesareboundintoaconfigurationtoensurethatseparatelycompiledpieceshaveusedconsistentversionsoftheshareddefinitions.Interfacesproducenoexecutablecode;theymanifestthemselvesatruntimeprimarilyassymboltablesthatareaccessiblefordebuggingandsimilarpurposes.Programmodulesprovideimplementationsofabstractions.Theytypicallydeclarecollectionsofvariablesthatdefinetheirstateandprovidebodiesfortheproceduresoftheirinterfaces.Viewedassourcetext,theyaresimilartoPascalproceduresandSimulaclassdefinitions.Theycanbeloadedandinterconnectedtoformcompletesystems.Atruntime,oneormoreinstancesofanimplementationmaybecreated.Aseparateglobalframe(activationrecord)isallocatedforeach,containingstorageforitsglobalvariables(thosewhicharedeclaredoutsideitsprocedures),whichpersistbetweenapplicationsofitsprocedures.Thelifetimesofimplementationinstances(unlikethoseofprocedureapplications)arenotrestrictedtofollowanyparticulardiscipline.Communicationpathsamongimplementationsareestablisheddynamicallyandarenotconstrainedbyany(staticordynamic)nestingrelationships;lifetimesandaccesspathsarecompletelydecoupled.Themodulebodyitselfgenerallycontainsthecodetoinitializetheglobalvariablesandestablishanynecessaryinvariants.Itwillbeexecutedwhenthemoduleisstarted,oruponapplicationofoneofthemodule'sprocuedures,whichevercomesfirst.Amodulethataccesses(reliesondeclarationsfrom)othermodulesmustincludeDIRECTORYstatements,sothenecessarysymboltablescanbeacquired.Ifitusesonlyasubsetofthedeclarations,itisgoodpracticetoindicatewhichoneswithaUSINGlist.DeclarationsinaninterfacearepublicunlessdeclaredtobePRIVATE.Normallytheimportingmoduleaccessesonlythepublicnames;privatedeclarationsmaybeaccessedbyimplementingmodulesthatindicatetheySHAREtheinterface.Adirectorystatementmaylistthenameofafilecontainingthesymboltabletobeused,butifthefilenameisthesameasthemodulename(exceptfortheextension.bcd)itisomitted.Amodulethatusesnon-constantdeclarations(e.g.,exportedtypesandprocedures)fromanotherCEDAR4.2vî;ïgwî 9ïgî òïgvî$Rïgwî%:ïgvî,ïgwî-+ïgsîHDïgxî ìï_î]î£î´vî ®ï[²î¬îéîaîdîãî$dî&r î-î3$î5'î90î:Ûî>ÄîD�îG/î ìïZ îî¿îîgî"î#± î,9î2xî5î9Ë î@BîCžîGRî ìïXcîîNî÷î¯îB î(9 î.óî0ƒî2î3Hî7Lî=ƒî@RîAÖîEüî ìïV¼îeîUîîöîî¶î#î'Ùî)‘î+>î1<î3º î;› îD›îGRî ìïUîXî ®ïR™zîiïR™îïR™vî¶ïR™î[ïR™î îšî$ªî*Kî.î1K î:î@pîD�î ìïPò î}îNî î"ãî%H î+ýî1àzî3ÁïPòî4\ïPò î:Ôvî@ÂïPòîAhïPòzîC¡ïPòîD·ïPòvî ìïOK îîô îîsî kî# î%:î*Ýî,µ î2ñî5Òî7&î9Úî?0îAîFØî ìïM£î�î»îwî&î Ú î)lî- î ®ïK(î‰îŸîÃî òî$&î%ãî(Fî,? î3) î:(î<¬î>¶îA/îFî ìïI�î šî îRîèzî=ïI�îØïI�îÍvî9ïI�î ïI�î"]î#‡î'î- î3î5Ìî<î>=î@Èyî ìïF2vî ®ïBãî0îŽîºî¾ î!Úî#aî%šî)‹î0—î2­ î9ûî:þî?SîB î ìïA<î Ãîcîîîbî( î"  î*�î,Vî1yî2ºî7Bî9 î@îBßîD¥î ìï?• î&î~îîZî &î"†î%îî'§î,ÿ î ®ï=îêîxî^îMîA{î"yï=î#Uï= vî*Óï=î+ýï=î0êî52zî9¦ï=î: ï=vî?0ï=î@Gï={îC9ï=îCòï=vî ìï;rîÈîÖîµî î!Úî%!zî&Ïï;rî'2ï;rvî-[ï;rî-Éï;rî0ä zî ®ï8÷ î·îvî^ï8÷î‡ï8÷îþî#T î)šî+e î3Yî6þî<ŸîAzîE)î ìï7Pî ýî9 î©î…îî#°î&Œî*ÿî,Üî.*î0kî2Hî8ïî=¯îA\îF·zî ìï5¨îZvî­ï5¨îoï5¨îbî›îçîÈzî!êï5¨î"…ï5¨vî&ï5¨î&¨ï5¨zî( ï5¨î)ï5¨ vî2ï5¨î2ßï5¨î7�î9Æî@pîD î ìï4zî ;ï4î ëï4vîFï4îªï4îzî>ï4îÙï4 vî~ï4îìï4î'î"‡î%Q î+¸î1±î5Äî9î<= îB�îGÖî ìï2Zî �î9 zî£ï2Zî>ï2Zvîáï2Zî-ï2Zî$Êî' î.î2!î5tî;G îB{îDXî ìï0²îéî—î_îKîîm î%­î'ëî.¤î1[î5ázî ®ï.7vîŠï.7î³ï.7îNîšî(=î*7 î2Oî6î;Þî@Ü îGÖî ìï,�îÒîËî/î¡îýî ßî&î*šî-î/� î6¿î8£î< îBÁîGáî ìï*èîEî^îwîÔîcîî!G î(Wî+î/Éî3 î:2î=Äî@YîBSîFØî ìï)A î1îàîGî/î ®ï&ÆîÃîmî3îzî¾ï&Æî!ï&Ævî"œï&Æî#Wï&Æî$ozî&zï&Æî&Ýï&Æ vî0ï&Æî1<ï&Æî30î5;î:vî<zîA�ï&ÆîB@ï&ÆîE¶vî ìï% îæîïî›î¢î î#é î*ãî/Õî2Szî4nï%î5ï%î8ºvî>”ï%î?ï%îBíîG;î ìï#wîŠîmîa îTzî"{ï#wî#,ï#wvî&Åï#wî'Œï#wî,M î3ýî5Ïî7à î?<îB-îGÖî ìï!Ð î!îHîPî#Eî%Tî,- î4“î7<î: î@\îB`îFîî ìï ) î' î­ î Èî$wî)î3jî5 î<Ï îDîG;î ìï�î M î�îtîîïîŸî#”î(= î0¦î6!î8Äî<½î@TîB“ î ìïÚ îî'î[î î �î&·î,Nî.áî2[î4= î:î<“î@éîF×î ìï3îîî" î¼î +î"Ïî$·î*lî.î0pî5hzî6Ëï3î7Oï3vî:°ï3î;„ï3î=@î@Ì îGÖî ìï‹î ˜îQî°î� î³î%@î)nî ®ïîŽîâzîïîµïvî†ïîÿïî ñî#L î+6î/kî3^î96î<òwîB&ïîC ïvî ìïi îøîµîîîÜî#Âî&Gî(1î.)î/¤î0ôî3æî6úî8îãzîAAïÁîAòïÁvîEOïÁîFïÁî ìïîÉîÐwîïîÁïvîïîCïî Èî#î*8î/‘î5 î8’î;Jî?ÝîDòî ìïs îaîCîîlîF î%äî+Gî-ôî3wî5îïsî6Žïsvî:$ïsî:’ïsîîC©î ìïËî"î'îeîÅî†î?îjî Ô î'Žî)îî.·î2 î3Ïî5Àî9Uî;×î=8î?™îBîEÃîG/î ìï $î iîîwîwî6îî!=î#œî)»î-9î.�î/ûî ®ï ©îYîxîeî} î!Ì î)�î,ûî2Õî6ˆî9_ î@þîD„wî&Žïûî+  ‚TVm$:CEDARLANGUAGEOVERVIEW7modulemustexplicitlyimportit.Ifamoduleimplementsanypartofaninterface(e.g.,bysupplyingthevalueofaprocedureortypethatitdeclares),itmustexplicitlyexportit.ThecompilerwillcheckthatitsPUBLICdeclarationsaretype-consistentwiththecorrespondingdeclarationsintheexportedinterface(s).Eachmoduleiseffectivelyparameterizedbyasetofinterfacerecords,oneforeachinterfaceitimports,andsuppliesasetofexportrecords,oneforeachinterfaceitexports.Notethatinterfacesandimplementationsneednotbeinone-to-onecorrespondence.Bindingagroupofmodulestogetherintoaconfigurationinvolvesassigningvaluesfromtheexportrecordstothecorrespondingfieldsintheinterfacerecords.Thereisaspecialsublanguage,C/Mesa,tocontrolthisprocess.Accessingothermodulesintroducescompilationorderdependencies.Eachmodulemustbecompiledafterthemodulesitaccesses(andrecompilediftheychange),sincethecompilerneedstheirsymboltables.Butinformationdoesnotflowintheotherdirection.Modulesthatarenotaccessedbyothers(virtuallyallimplementations)maybefreelyrecompiledwithoutinvalidatingpreviouscompilationandcheckingofanyothermodules.Types,aswellasprocedures,canbedeclaredopaquelyininterfacesandsubsequentlyboundtoconcretevaluessuppliedbyimplementations.Thismakestheinternalstructureofthetypeinvisibletoclientsoftheinterface,andensuresthattherecanbenocompilationdependenciesbetweenthedefinitionoftheconcretetypeandtheinterfacemodule.Thedefinitionofthetypecanbechangedatanytimewithoutrequiringrecompilationoftheinterfaceoranyclientsoftheinterface.EffectiveuseofMesarequiresathoroughunderstandingofmodulesandtheiruse.Theyhavesignificantlyinfluencedourprogramdesignandconstructiontechniques.Programsarealmostneverself-containedmodules;theimportationandre-useofexistingcodehasalltheadvantagesoftheftoverhonesttoilwithoutthemoralstigma.Considerableemphasisislaidonthecarefuldesignofinterfaces,andontheirdocumentation.Sinceitisonlyinterfacechangesthatforcerecompilation(orperhapsevenrewriting)ofclientprograms,itisimportantthatinterfacesremainstableforsubstantialperiods,evenwhiletheirimplementationsareundergoingchange.Arecommendedapproachistodefine,comment,andcirculateforreview,alloftheinterfacesina(sub)systembeforewritinganyoftheimplementations.Interfacesplaymuchthesameroleas"programdesignlanguages"inotherenvironments,withtheadditionaladvantagesofbeingpreciselydefinedandmechanicallyenforced.TheMesalanguagedefinitionomitsmanyofthefeaturescommonlyexpectedinprogramminglanguages,suchasinput/outputandstring-manipulationoperations.Ofcourse,thesefacilitiesareavailabletoMesaprogrammers,buttheyareprovidedbypackageswritteninthelanguageitself.ThedescriptionsofstandardpackagesintheMesaProgrammer'sManual,Version8.0,runtomorethan300pages.Whenmanaginglargecollectionsofmodules(andinsystemsliketheMesaDevelopmentEnvironmentandCedartheyrunintothethousands),modulenamesbecomeveryimportant.Theuseofcrypticoracronymicnamesisdiscouraged.Byconvention,sourcefilenameshavetheextension.mesa,andobjectfilenameshavetheextension.bcd(forBinaryConfigurationDescription).ThedefinitionsmoduleforaninterfaceXiscustomarilynamedX;ifitisimplementedbyasingleprogrammodule,thatiscustomarilynamedXImpl.ExceptionsMesaprovidesawaytoindicatewhenexceptionalconditionsariseinthecourseofexecutionandanorderlymeansfordealingwiththemthatisinexpensiveiftheydonotarise.Exceptionscauseatransferofcontrolfromthestatementthatraisesthemtoadynamically-selectedpartoftheprogramintendedtohandlethesituation.Theymayberaisedinresponsetothedetectionof"impossible"situations,invalidinputs,theinabilityofanabstractiontosupplyitsspecifiedservice,orsimplyunusualevents.CEDAR4.2vî;ïgwî 9ïgî òïgvî$Rïgwî%:ïgvî,ïgwî-+ïgsîHDïgvî ìï_'îãîB zî!ï_'î„ï_'vîkï_'îÎï_'îî‰î ªî%¡ î-î/™î2tî4$î6 î;¨î>úî@íîG/î ìï]î ¤îlî¥î6î î(îî j î&Œî'ñî+h zî1^ï]î1ùï]vî5©ï]î6 ï]î7eî:Lî@îBÐîFÁî ìï[Øwî §ï[Øî Oï[Øvî,ï[Øîóï[Ø î¢îÖî#î&î(N î1% î8›î:*îÿîBbîH9î ìïWµîXîîoî¢îÇzî‰ïWµî$ïWµî Îvî$ñïWµî%×ïWµî(‹î*Òî. î3ºî5î:Nî=Íî@¥ îFØî ìïVîJî¢îîýî¦ î$‘î.­î3Þî5î9î:´î@3îE’îHezî ìïTg vîïTgîzïTgîTî!î!6î$„î&Êî+î/ºî1Oî3– îlîAºîC‘zî ìïN�vî EïN�î ´ïN�îËîuîòîPî§ î&õî(|î+²î1Rî4ëî7qî=RîAYîDÇî ìïLõîLî î±îþî�î!Æî#‘î& î)È î0î5Ðî8»î;+î=½îCSîEkî ìïKN îáîßîÉîÚî!Øî%Æ î,üî2 î9¢î?? îFØî ìïI§î¨îaîî¡î ®ïG,î=îî/î î’î"Hî$czî*ïG,î*ÃïG,vî/äïG,î0GïG,î1¼ î8î:ó îC[îGàî ìïE„îvî´îTî`î&*î)Tî-�î0 î52î:ÿî<Èî?8îBXîGàî ìïCÝîî¼î îìî�î`î"î%Šî'þî)Øî+È î3< î;£î@ûîCD î ìïB6î ¸î+î¸îÛî¥îî!Ðî';î*& î0„î2Pî4Ãî7æî:„î<ˆîB îC¶îFiî ìï@Žîøîõ îªîcî!Âî'hî),î+Íî0î1Êî4* î ®ï>î«îWîFî'î «î" î(5 î1oî3_î9î<î?†îB‰îFHî ìï½îCÍîGî ìï8Iî Üî< î8îòî:îTî!º î*î,xî0nî5 î=rîCeîDÑîG‰î ìï6¢î GîÔîîÓ îQî î"î%G î/î2±î4î5jî8î> îCHîFî ìï4ú î”îÅîæî î#iî%î(Êî/)î0sî1Óî8(î:ê îAîE¢î ìï3Sî ) îùî0îwî+î"rî,Õî/( î6qî ®ï0Øî; î3î3î î Oî$âî+Dî-üî3ƒî5Áî:î*î@‹ îF¶îHeî ìï/0 îkî¹îjî îÂî! î+Ú î2$î5'î8ýî;[î>×îA£îCPî ìï-‰îA îAîõî™ î#Šî&ªî) î/Œ î6�î8Lî<îAÒîFØî ìï+â î'î ®ï)fîÀî¤î¥ î *î$%î(*î*î,·î2î9î?î@ü î ìï'¿ îhîtîû îî¯î+» î2›î4…î9î‘îD7î ìï±î ºî& î…î yî ìïb vî ®ïîgîîAî*îéî!&î$ì î,: î2îî69î7øî:hî>Èî@’îFØî ìïkî îþîoîÙîÙî !î#×î&Òî(k î0 î1šî4Öî7 î9¬zî=kïkî>^ïkvîDƒïkîEïkîHeî ìïÄîîñîÄîLîÌî""zî%ïÄî%•ïÄvî(ñïÄî)`ïÄî,›î.jî/´î<¢î?¦îA€îDî ìïîézîØïî•ïvîwïîæïî îKî#î&Yî(Šî,Íî.¼î4¢î6‘î91î?fîA_ î ìï u î^îëîmîÇî!&î"Úî$Å î+¼î-fî1Òî3¨î9_î>8î?÷îDbî ìï Îwî&Žïûî+  òTVm$ÓCEDARLANGUAGEOVERVIEW8Mesaexceptionsareconceptuallysimilartoprocedures,exceptthatthebindingtothehandlerisdeterminedbysearchingthecatchphrasesinthecallstackoftheprocessinwhichtheexceptionisraised;thedynamicallyinnermosthandlerthatacceptstheconditionisapplied.Likenormalprocedures,handlerscantakeparametersandreturnvalues.Theyarewritteninadistinctivesyntaxthatclearlyidentifiesthemascodefortheexceptionalcase.CatchphrasesaresyntacticallyandsemanticallysimilartoSELECTstatements,withtestitemsindicatingtheexceptionsforwhichtheassociatedhandlershouldbeapplied.Therearespecialtestitemstocatcharbitraryexceptionsandtocatchanattempttounwindtheapplicationstackinresponsetoanexception.Aseriesofcatchphrasesmaybeassociatedwithaprocedureapplication,orenabledthroughoutablock.Ahandlerislikeaprocedurebody,butwhenitcompletes,thereareanumberofadditionalcontroloptions:GOTO,EXIT,LOOP,RETRY,CONTINUE,REJECT,andRESUME.Resumptionisanalogoustoreturningfromaprocedure,possiblywitharesult.ExceptionsaredividedintoSIGNALs,whichmayberesumed,andERRORs,whichmaynot;incommonparlancetheyaregenerallyallcalledsignals.Sincehandlersmaytakeparametersandreturnresults,eachexceptionnamemustbedeclaredinascopethatincludesallthepointswhereitisraisedaswellasallthecatchphrasesthatacceptit.Thecostofraisinganexceptionissignificantlyhigherthanthecostofprocedureapplication,butitshouldn'thappenveryoften.Thesystemguaranteesthatallexceptionsarehandledatsomelevel;thosethattheprogramfailstocatchareacceptedbythedebugger,keepingintactthestateoftheprogramthatraisedit.Exceptionscanbeusedinveryintricatewaystoachievesubtleeffects(e.g.,byraisinganotherexceptionwithinahandler).Experiencehasshownthatthisisalmostalwaysamistake.Somecallitelegance,otherscallitincomprehensible:"Fortheprogrammer,themainimportofnestedsignalsisthatoneneedstoconsider,whenwritingaroutine,notonlywhatsignalscanbegenerated,directlyorindirectly,bythecalledprocedures,butalsothosewhichcanbegeneratedbycatchphrasesinthatprocedureoreventhecatchphrasesofanycallingprocedures,alsobothdirectlyandindirectly."[MesaLanguageManual]Althoughhislanguageproposalshavenotbeenimplemented,RoyLevin'sdiscussionintheworkingpaper[Indigo]Style>SignallingGuidelines.pressisthebestsourceofguidanceontastefulandappropriateusesofexceptions.Themostimportantpointisthattheexceptionsaproceduremayraisemustbeconsideredpartofitsinterface,anddocumentedassuch.Unfortunately,thecompilercurrentlydoesn'tenforcethis,andmanyotherwiseexcellentinterfacesdonotcomply.Processes,monitors,andconditionvariablesMesaprovidesefficientmechanismsforconcurrentexecutionofmultipleprocesseswithinasinglesystem.Thismakesitnaturaltostructureprogramstoreflecttheirinherentconcurrency.Mesaalsoprovidesfacilitiesformutuallyexclusiveaccesstoresourcesandprocesssynchronizationbymeansofentrytomonitorsandwaitingonconditionvariables.FORKmakesitpossibletostarttheexecutionofanotherprocedureconcurrentlywiththeprogramthatappliesit.Itreturnsaprocess,whichmayeitherbedetachedtoproceedindependently,orsavedforafutureJOIN.Thereisnoruleagainstmultiplecoexistinginstancesofaprocedure,eitherforkedorapplied,althoughcaremustbetakentoensuremutualexclusiononaccessestosharedglobaldata.JOINtakesasingleprocessargument.WhentheforkedprocedurehasexecutedaRETURNandtheJOINhasbeenexecuted(ineitherorder),thereturningprocessisdeleted,andthejoiningprocessreceivesitsresultsandcontinuesexecution.Aprocesstypeisdeclaredsimilarlytoaproceduretype,exceptthatonlythetypeoftheresultisspecified.CEDAR4.2vî;ïgwî 9ïgî òïgvî$Rïgwî%:ïgvî,ïgwî-+ïgsîHDïgvî ®ï_/îs îHî· î!Íî&nî(9 î/´î4 î7 î9…î>·î@�îBüîH#î ìï]ˆ î`î†îÅzîOï]ˆîêï]ˆî vî%ï]ˆî%hï]ˆî&Þî)hî,î/»î1Ÿî4)î9(î;î?9îAÃîH#î ìï[àîaîº î_îÏî#Ózî&›ï[àî'Kï[àvî+>ï[àî+­ï[àî-—î3°î5î:Pî=yîB/ î ìïZ9î©îcîŠ î¾î£î$î(³î,jî.ëî3Ìî5¨î7 î=¼îB.îE*î ìïX’ îßîhîî]îšîú î$7î ®ïVîûî;îå î òî$ î,"î0þwî3ïVî3¡ïVvî7ÿïVî8ƒïV î?gîBØîE¹î ìïTo îBî– îDîuîwî!Ë î(,î-+î1œî3�î8·î<­î>õîCeîEåî ìïRÈî ¦îHîù î¾î‚î <î#Ýî%Ùî*òzî,¬ïRÈî-iïRÈvî1qïRÈî1àïRÈî3Ü î:úî>yî@3îEäîGžî ìïQ îYîÆîfîÿîuî?î"#î#ô î*Aî-<î.Fî4ª î;ôzî=™ïQ î>3ïQ vîBfïQ îBÕïQ î ìïOyî î ®ïLýî/î0î‘î1îPîÉî"”î% î(´î* î0ºî48î6�î7 î<Áî>p îDÜî ìïKVwî•ïKVî„ïKVvîöïKVwî$ïKVîÝïKVvîÔïKVwîïKVî»ïKVvîïKVwîIïKVîïKVvî 7ïKVwî!eïKVî"/ïKVvî'žïKVwî(ÌïKVî) ïKVvî-ïKVî.@ïKVwî1IïKVî2ïKVvî6&ïKVî7SïKV î?gîA$îGàî ìïI¯îþîoî¢ î‡î Ýî$î%4î)a î0fî2Âî7Áwî:£ïI¯î;BïI¯vî?ïI¯î?“ïI¯î@yîD‘îGžî ìïHîÔwî‹ïHîDïHvîœïHî!ïHîýî îî!ýî#«î)[î.àî1ðî4Cî:*î<î@î ®ïEŒîfîùîîü î#î%Àî)òî.�î1Ñî8 î;Íî?8îA,îF´îHeî ìïCåî ·î…îéîÙî9î\î"tî#Êî%6î)8î*æî-Ôî/‚î1rî3Ñî7fîW îE¼îH9î ìï?ÂîôîÞîìîÖî­î#' î)õî,Âî.± î5iî7¼î=î> îB2îEðî ìï>î ÕîPîúîîÍî}îìî%®î'Åî*@î0¼î6î9êî#îB/ î ®ï0ßî+îóîŽî˜î î î$Sî&Kî)Üî.Âî0mî37î9¶î;vî>¸îAîD¥î ®ï/8îgîîl îÌî˜î"Ôî'Êî*� î1¨zî2 ï/8î3`ï/8î5³î<vî@–ï/8î ®ï,¼î¾îâî™î ©î#áî&Gî)• î21î5î9Ô î@HîAçîD8î ìï+î ºð3î.î/fî1²î4ƒî8¿î:eî@#îBîFØî ìï)n î^îkî7 wîlï)nvîIï)nî 5î#¤î*î-Ëî/Jî2+î4ž î;jî<§îC=îFTî ìï'Æî SîB î&îîÀî™ î"•î%K î-#î.Ðî2W î;šî=øîC²î ìï&îªî”î�îEîî#9î(ô î/î1%î3šyî ìï"Ð îŽîŸî?îFvî ®ï€îkîîz î#Dî%– î,�î2Ùî4¦zî:3ï€î:ãï€vî@ï€îA ï€îDfîE¤î ìïÙîñî=î¨î0îîõî$åî+*î- î1vî4ïî:š îBçîFÂî ìï2î� î!î€îiî#gî'–î)fî/…î2^î7SîASîCpîGÖî ìïŠî €zî.ïŠîDïŠvîÄïŠîiïŠî{îNzîUïŠîðïŠî$8 vî ®ïwî •ïîqïvîœïîÆïîÝî;î…î<î Tî"»î(øî*ºî/Íî6X î>ZîA|îCäî ìïhî ²îQîöîeîî1îUî#Zî&Uî*9zî,"ïhî,Òïhvî1¬ïhî2ïhî3Rî8� îAÔîC�îGRî ìïÀî <wî‡ïÀîïÀvî1ïÀî4ïÀî\îîîîî"Üî(| î/î4üî6Ûî8+ î?-îC?îGËî ìïî/îëîÙîAî2î òî" î'î+¹î1Áî3Èî8ÿî:­î?îC6î ®ï�wî Hï�î%ï�vîèï�îWï�înî î”îqî#ûî(î*„î.ñî5}î7úî=Àwî>òï�î?Æï�zîDKï�îDûï�vîF÷ï�îGfï�wî ìïövî ðïöî ·ïöîQî™îBîUî-î"žî$êî*Þî/�î0õî6 î8°î:ûî?�îDMî ìï Oî ÉîîÖî î“î!#î%ùî) î*{î0î5Ÿî7Pî8}î?îBmîFÁî ìï §î îeîuî.îŽîYîÄ wî&Žïûî+ ÿ �TVm$xCEDARLANGUAGEOVERVIEW9Allprocessesexecuteinthesameaddressspace.Thismeansthattheyarenotprotectedfromeachother,whichispresumablyacceptableinasingle-usersystem.Italsomeansthatprocesscreationandswitchingbetweenprocessesischeap(notmuchmoretime-consumingthanaprocedurecall).Generally,twoormorecooperatingprocessesneedtointeractinmorecomplicatedwaysthansimplyforkingandjoining.TheinterprocesssynchronizationmechanismprovidedinMesaisavariantof"monitors"adaptedfromtheworkofHoare,BrinchHansen,andDijkstra.Theunderlyingviewisthatinteractionamongprocessesisalwaysbasedonaccesstosharedresources(e.g.,data)andthatapropervehicleforthisinteractionmustunifythesynchronization,theshareddata,andtheproceduresthatperformtheaccesses.Amonitoristypicallyamoduleinstance,withshareddatainitsglobalframe,anditsownproceduresforaccessingthem.Someoftheproceduresarepublic,allowingapplicationsofmonitorproceduresfromoutside.Obviously,conflictscouldariseiftwoprocesseswereexecutinginthesamemonitoratthesametime.Topreventthis,amonitorlockisusedformutualexclusion.Applicationofoneofamonitor'sENTRYproceduresautomaticallyacquiresitslock(waitingifnecessary),andareturnreleasesit.Anintegrityconstraintthattheprogrammerimposesonthemonitor'sdataiscalledamonitorinvariant.Thelockmakesitpossiblefortheprogrammertoensurethatthisinvariantwillbetruewheneveranentryprocedurebeginsexecutionregardlessofwhatishappeninginvariousprocessessimplybymakingsurethatitistrueinitiallyandthateveryentryprocedurerestoresitbeforereturning.Ofcourse,aprocessmayenterthemonitorandfindthatthemonitordataisinagoodstatebutindicatesthattheprocessmaynotproceeduntilsomeotherprocessentersthemonitorandchangesthesituation.TheWAIToperationallowsaprocesstoreleasethemonitorlocktemporarily(andsuspendexecution)withoutreturning.Thewaitisperformedonaconditionvariable,whichisassociatedbyagreementwiththeactualconditionneeded.Aftermakingachangethatmayhavechangedthecondition,someotherprocessmustperformaBROADCASTorNOTIFYontheconditionvariable;thisallowsawaitingprocesstoreacquirethelock,retestthecondition,andresumeexecutionifitistrue.Notethatsinceawaitreleasesthelock,themonitorinvariantsmustberestoredbeforewaiting.Theproceduresofamonitorareclassifiedasentry,internal,andexternal.Internalproceduresmayonlybeappliedbyentryorinternalproceduresofthesamemonitor,sincetheyareintendedtobeexecutedwithinthemonitor'smutualexclusion,butdonotacquirethemonitorlock.Externalproceduresarelogicallyoutsidethemonitor,butaredeclaredwithinthesamemoduleforreasonsoflogicalpackaging.Beingoutside,theymustnotreferenceanymonitordatanorapplyanyinternalprocedures;theyareoftenusedtoprovideaconvenientinterfacethat"hides"oneormoreapplicationsofentryprocedures.TheattributesENTRYandINTERNALareassociatedwithaprocedure'sbody,notwithitstype;thustheydonotappearininterfaces.Fromtheclientsideofaninterface,amonitorappearslikeanyothermodule.Insimplecases,amonitor'sdatacomprisesitsglobalvariables,protectedbyanimplicitlockthatisautomaticallyallocatedinitsglobalframe.However,manyapplicationsdealwithmultipleobjects,represented,say,asrecordsaccessedthroughpointers.Itmaybenecessarytoensurethatoperationsontheseobjectsareatomic,i.e.,oncetheoperationhasbegun,theobjectwillnotbeotherwisereferenceduntiltheoperationisfinished.Itispossibletoassociatealockwiththeobject,ratherthanwiththemodule'sglobalframe,bydeclaringthedataasaMONITOREDRECORD.Asinglemoduleinstancecanthenimplementeachoperationasanentryprocedure,takingtheobjectasaparameter.LockingisspecifiedinthemoduleheadingbyaLOCKSclause.Asomewhatsubtlesourceofdeadlocksoccursifcontrolleavesanentryprocedurebymeansofanuncaughtexception.Unlessitiscertainthatallexceptions(includingthoseraisedbyinvokedprocedures)arehandled,eachentryprocedureshouldincludeanUNWINDcatchphrase,whichwillimplicitlyreleasethemonitorlock.ControlconstructsCEDAR4.2vî;ïgwî 9ïgî òïgvî$Rïgwî%:ïgvî,ïgwî-+ïgsîHDïgvî ®ï_/îî îî¼î"î!¥î&–î*©î-Êî2î4éî7ÿî:Yî<ÕîBðîF^î ìï]ˆî üî"î§ î) î!ñî#¸î$ú î+íî0Øî2hî5Mî9©î<�îA}îFØî ìï[àîîoîlîØî Ðî#¾î'•î+( î53î8Yî9ƒî@î ®ïYe îPîçî•î î"rî(Zî+¡î-:î2î3³î70 î>ÈîBîEî ìïW¾îîîEîb î">î,bî3Úî9ñî;åî?ÓîA…îBôîGÖî ìïV îîWîÅî+î®î!mî%úî*|î/Ûî2™î88î; îB îEOîFÁî ìïTo îÍîZî^îÐî!;î%$î'0î+Dî,ùî1fî7jî:Ëî>PîAîCãîEî ìïRÈîÃî0î î î¢î"pî$ÿî/dî1óî6ˆî:î<ûî?Š îFÁî ìïQ!îDî£î ®ïN¦îîFî—îîîôî%î(î,Êî/´î1Gî3î7î;Cî=ßî?ŸîBˆ î ìïLþî îõîÈî�î<î� î$‡î&Íî+Qî0Ç î8Oî9ûî?. îF(î ìïKWî îÝîBîî"5î#Œî&.î,!î/iî5‰î7-î9ƒî<öîB-îC¼îFî ìïI°î ‡îÌîêîzîJïI°î`ïI°îyvî!�ïI°î!óïI°î#î&tî(Ïî-¡ î4 î;±î=ˆî@RîB)îCqwî ìïHvî‚ïHîIïHî¾ îfî#þî&î);î.½î0R î7lî:Xî;·î@îEYîG<î ìïFaî\ î©înîÄ î"�î'Õî)Òî,(î2=î58î6›î:‰zî;©ïFaî<¿ïFaî@±vîEäïFaîF·ïFaî ìïDºî òî7îšîèî2îŸ î$Žî&Iî*»î-–î0Dî6î8Ïî:Ìî=½îCþîEûî ìïCî‘îî"•î$pî'ïî)|î0cî23î7îBˆîD¦î ìïAkî åî´î îuîYîXîzîÞïAkî yïAkvî#]ïAkî$ïAkî&ðî-sî2~î3Ôî8# î ®ï>ðîÓîŽîÌî´îÌî iî"Üî(1î*ýî-ÿî0áî3Uî8ªî;Ãî=Cî?î@CîCÉîGî ìï=Iî�îkîËîŸî£îî$Pî'—î+*î.Éî3�î7ªî: î?KîBîG/î ìï;¡ îwîï;¡î"ï;¡vî£ï;¡î^ï;¡îõî!Kî"�î'šî)qî.î0§î6î93 î@ÅîDî ìï9ú îÕî îµzîÇï9úî ¯ï9úvî"ñï9úî#Tï9úî$—î+•î-Õzî/9ï9úî/Ôï9úî5Wvî9èï9úî:ÿï9úî?Gî@í îG“î ìï8Sî€î‚îÇî±î¶î$½î(Bî-î."î2°î5eî8Oî;|î@ÒîC î ìï6«î eîéî£îðî-wî=ï6«îöï6«vî&«ï6«î'fï6«wî(Tï6«î)=ï6«vî-ï6«î-Ùï6«î/ î1Nî7Sî<èî?oîC‚îD‘î ìï5îÍîˆîžî îhî *î"– î)î+ßî0´î6öî8dî9Çî;?î>‡îB îDæîHeî ìï3]î åîïîOî îîA î%‹î(ôî*äî01î4€î ®ï0âîŠ î•îRî€îÅî! î&ýzî(¯ï0âî)Jï0âvî+¢ï0âzî,ƒï0âî,æï0âvî1ï0âî1æï0âzî4¢ï0âî5=ï0âvî9eï0âî:Eï0âî?€ îF‹î ìï/:î 1îMîbî‰îHî7î!x î(ªî*Žî-î0Áî6†î:$î=_î?ÝîEÅîGžî ìï-“î‘î¾îî î © î&òî)\î+Kî-¨î2pî4¸î9âî=îBˆ î ìï+ìî îbîî@î´î î"=î'�î+¼î-öî1Nî6(î8@î<ùî>ŒîBÀ î ìï*Dî øî9îjzîòï*Dî±ï*Dvîvï*Dîúï*Dî"”î%Uî*·î-Üî0‡î4sî74î`îAô î ®ï&"î‡ wîœï&"îVï&"vî ï&"î¯ï&"wîÁï&"î+ï&"vî#9ï&"î#ßï&"î%Ž î+ûî/î0A î7¡î;xî=îîA îBåîFoî ìï${î îî�îîÓ î\î"9î$ î(hî+Hî- î/ î5î68î;�î@”îCGîEðî ìï"Óî ®ï Xî{îÞî¨îÐîìî ïî'Nî)'î-H î3Zî9mî;gî=VîB_îEWîH#î ìï± îªî»î´îÙî!Gî%àî,`î0u î8Vî;šî?zîDÄï±îEuï±vîH²ï±î ìï î²îmîî÷î uî%±î+Yî,Õî/Ýî1Ñî7éî9›î>î@× îG‰î ìïbî ~î$zî�ïbî1ïbvîfïbîKïbîèî8î!¡î'Óî*Qî.áî1Jî5lî8 î:žî<˜îBÊ î ìï»î XîÜî+î»îzîî §î&î'áî-«î.úî2î5Xî7ÜîÕ îDïî ìï Tî Kî�yî ìï îö wî&Žïûî+ ÿËTVm$ÙCEDARLANGUAGEOVERVIEW10Mesa'sfacilitiesforordinarysequential"programminginthesmall"areextensive,butfairlyconventional.Thesyntaxisnotexactlylikethatofanyotherlanguage,butforthemostpartitcanbepickedupeasilywithafewminutesstudyofthegrammar.(Infact,sincemostprogramtextisproducedeitherbyeditingexistingprogramsorbytheuseoftheTiogaeditortoexpandsyntactictemplates,youmaybeabletojust"fakeit.")ThissectionmentionsanumberofareaswhereMesaprovides"convenience"extensionsorconceptuallysmallchanges.SELECTstatementsgeneralizePascal's"case"constructbyallowingseveralwaystospecifyhowonestatementistobechosenforexecutionfromanorderedlist.Themostcommonformisbasedontherelationbetweenthevalueofagivenexpressionandthoseofexpressionsassociatedwitheachselectablestatement.Therelationmaybeequality(thedefault),anyrelationaloperatorappropriatetothetypesofthevaluesinvolved,orcontainmentinasubrange.Asingleselectionmaybeprefixedbyseveralselectors,andanoptionalENDCASEstatementisselectedonlyifnoneoftheothersare.Discriminatingselectionisusedtobranchonthetypeofavariantrecordvalue(andinCedar,onthecurrenttypereferredtobyaREFANY).SELECTexpressionsareanalogous,butchoosefromanorderedlistofexpressions.Iterationisprovidedbyloopstatementsinwhichseveraldifferentkindsofcontrolcanbefreelyintermixed.Aloophasacontrolclauseandabody.Thecontrolclausemayspecifyalogicalconditionfornormaltermination,possiblycombinedwitharangeorasequenceofassignmentsforacontrolledvariable.Inadditiontoordinarystatements,thebodymaycontainEXITorGOTOstatementstoexplicitlyterminateitsexecution,andmaybefollowedbyaREPEATclausethatactslikeaselectionontheGOTOusedtoterminatetheloop.(GOTOcannotbeusedtosynthesizearbitrarycontrolstructures.Itismuchmorelikea"local"exception.)InPascal,procedureexecutionmustproceedsomehowtotheendofthebodybeforeterminating;inMesa,itcanbeterminatedanywherebyexecutingaRETURNstatement.Iftheprocedure'stypeincludesresults,thereturnstatementmaysupplythevaluestobereturnedotherwisetheyaretakenfromtheresultvariablesnamedinthetype.Eachprocedurebodyisfollowedbyanimplicitreturn.Pascalproceduresarenotvaluesthatmaybeassignedtovariables;Mesaproceduresare.Inmostcases,theprogrammerstillthinksofaconstantassociationbetweenaprocedurenameanditsbody,buttotrulyunderstandwhatisgoingonwheninterfacerecordsarebound,ithelpstorealizethatprocedurevaluesfromtheexportrecordsarebeingassignedtoappropriatefieldsoftheinterfacerecords.ThissamepowerisavailabletotheMesaprogrammer;onepopularformof"object-orientedprogramming"isbasedonthecreationofanexplicitrecordofproceduresforeachkindofobject,andpassingaroundtogetherapairofpointers,onetotheprocedurerecord,andanothertotheobjectinstancedata.INLINEprocedureconstantsmaybedeclaredininterfacesorlocally.Thisisaninstructiontothecompilertoexpandtheprocedurebodyinlineforeachapplication,ratherthancompilingacalltoout-of-linecode.Itisintendedtoimprovethespeedwithoutchangingthesemanticsoftheprocedureinlinesarenotmacros.INLINEshouldbeconsideredaformoftightbindingbestreservedforlatestagesofsystemtuning;amongotherthings,itcancausethecompilertorunoutofresources,evenwhencompilingwhatappeartobesmallmodules.Inadditiontoproceduresandexceptions,Mesahasathirdmechanismfortransferofcontrol,calledaPORT.Whenusedinpairs,portscanprovideaverygeneralformofcoroutineimplementation.Insomecircumstances,coroutineshaveadvantagessimilartoprocesses,atslightlylowercost,buttheyarenotusedmuchinMesaorCedar.MiscellaneousEveryexpressioninaMesaprogramhasasyntactictypethatcanbededucedfromitsstructurebystaticanalysisoftheprogramtext,aprocesscalledtypedetermination.Thelanguageimposesconstraintsonthetypeofeachexpressionaccordingtothecontextinwhichitisused,eveninseparatelycompiledmodules.CEDAR4.2vîØïgwîÕïgî �ïgvî#ïïgwî$×ïgvî+µïgwî,ÈïgsîG~ïgvî ®ï_/î� îNîçîÒ î&° î0Oî2Yî5î9¾îî 2îëîî‰îwî³ï>î�ï>zî—ï>î 2ï>vî$ï>î$Õï>î& î)Pî+ î1”î7Dî< îB¤îD%îE›î ìïÀ îFYî ìï6ªîjî,î¥îîî!>î$\î(çî+aî/©î1qî3|î@7îCaîEÏî ìï5î Sî²î~î9î¿îmî!Íî%4î(§î/*î2¨î4î9¸î;´î=¤îB¯î ®ï2ˆîã îþîdîìî!-î$î'%î)(î.´î0u î6¼î:x îA’îDPîF2î ìï0áî ´î îñî�î°î gî!Žî&ú î-Ýî3Iî4pî:ðî>­îAbîC:îGî ìï/9î ‘îÙ îøîLî®înî kî$î)³î.}î0Çî5qî6½î:Sî;÷î@GîC î ìï-’î?îËîPîÅî¾î 6î$&î)Åî+˜ î3î6÷î8Õî;YîA$îFuî ìï+ëî qî¦îîÜî’îùî ª î) î+Àî0éî4Wî6î@L î ìï*Cî Yî;îBî¢îåîŸî�î!eî%¶î'p î.xî0¶î3èî7î8Óî=Dî?ýîDÑî ìï(œîPîyîRî î°î\î î!iî'ìî,”î/Kî4Wî6î8dî<}îAËî ®ï&!wî 2ï&!îï&!vî^ï&!î%ï&!îüî î!(î#4î(Óî*œ î0àî2¿î7‹î:¿îQ îEGîGî ìï$yîßîÆîÒîjî %î#Ûî'óî*iî-Ò î5tî9ºî=îC¼îEîGàî ìï"Ò îJîxîîzîÅî"î(î*ïzî/`ï"Òî0Gï"Òvî4Èï"Òî5cï"Òî;4î>#îDçîG/î ìï!+îÃî*î²îÏwî Sï!+î!<ï!+vî$yï!+î$þï!+î)î+ î2î3Bî6¼î8ˆî;ØîAîCøî ìïƒî 3îßîàî£î(îî"–î&?î*ºî,î.°î2oî4Ùî:žî÷îAvîC9 î ìïÜî 2îçîSî°î7î åî"Öî&tî ®ïaîpîÒîs îmî î&î)¹î,!î->î0šî7¿î9ðî>îî@šîE˜î ìï¹wî ï¹î ¯ï¹vîï¹îæï¹îðîî¾îeîÔî!Rî&Nî'jî*kî//î2ˆzî43ï¹î4Îï¹vî:ï¹î:vï¹ îD;îEüî ìï î îÔî5 î$Lî(íî*¶ î1'î2Úî7¾î;£î>äîA€îD«îGî ìïkî (îÿî­îVîyî ìï vî ®ïÍî§ îdîîCîðî#‚î%ûzî'(ïÍî'­ïÍî,Âvî/«ïÍî0ïÍî2}î5 î7î<Šî?ôîAÓîG“î ìï%î sî…î;î˜î$î1î Wî%(zî)ï%î)�ï%î+ÿ vî4ï%î4Ýï%î7²î=uîB´ î ìï ~î òîQî`îîI îî#Aî$ïî'Nî,"î-Ðî1Ýî33î4žî82î;xî=% îC‘î ìï ×wî&Žïûî+ QTVm$CEDARLANGUAGEOVERVIEW11Thesyntactictypeofanameisestablishedbydeclaration.Theformofaliteralimpliesitstype.Eachoperatorproducesaresultwithatypethatisafunctionofthetypesoftheoperands.ThetyperulesinMesataketwogeneralforms:Thetyperequiredbythecontextisknownexactly,andagivenexpressionmusthaveit.Therequiredtypeiscalledthetargettype.Examplesoccurinassignment,initialization,recordconstruction,arrayconstruction,argumentlistconstruction,andarraysubscripting.Severalcoercions(e.g.,pointerdereferencing,base/subrangeconversion,single-componentrecordtofield)willbeappliedifneededtoconvertavaluewhosesyntactictypeisnotitstargettypetoonethatis.Theexacttypeisnotimpliedbycontext,butarelationthatmustbesatisfiedbyasetoftypesisknown.Theprocessoffindingtypestosatisfythatrelationiscalledbalancing.Examplesincludegenericoperators(suchasrelationals)thatrequiretwooperandsofthesametype,conditionalexpressions,andselectexpressions.Thecommontypeselectedwillbetheonerequiringthefewestcoercions.AsequenceinMesaisanindexablecollectionofitems,allofwhichhavethesametype.Inthisrespect,asequenceresemblesanarray;however,thelengthofthesequenceisnotpartofitstype.The(maximum)lengthofasequenceisspecifiedwhentheobjectcontainingthatsequenceiscreated,anditcannotsubsequentlybechanged.Itistheresponsibilityoftheprogrammertokeeptrackofthenumberofitemsinthesequenceatanytime.Mesaallowsadefaultinitialvaluetobeassociatedwithatype.IfatypeisconstructedfromothertypesusingoneofMesa'sstructures,suchasRECORD,animplicitdefaultvaluefortheconstructedtypeisderivedfromthedefaultvaluesofthecomponenttypes,butitcanbeoverriddenwithanexplicitdefaultvalue.Defaultvaluesforargumentscansimplifyprocedureapplications;defaultfieldsofrecordsmakethecorrespondingconstructorsmoreconciseandmoreconvenient;initialvaluesareusefultoensurethatthecorrespondingstorageisalwayswell-formed,evenbeforethevariablehasbeenusedbytheprogram.DynamicvariablesinMesaareallocatedinzones.Thesearenotnecessarilyassociatedwithfixedareasofstorage;rather,theyareobjectscharacterizedbyproceduresforallocationanddeallocation.Thereisastandardsystemzone,butprogramsthatallocatesubstantialnumbersofsimilardynamicvariablescanoftenimproveperformancebysegregatingeachkindintoitsownzone.TheoperatorNEWisusedtocreateadynamicvariableinazone,andFREEtoreleaseit.TheMACHINEDEPENDENTattributeallowsprecisecontroloftherepresentationofvaluesatthebitlevel.CEDAR4.2vîØïgwîÕïgî �ïgvî#ïïgwî$×ïgvî+µïgwî,ÈïgsîG~ïgvî ®ï_/î†î!î1îêîîÓî ? î'Fî)B î ®ï]<î†îíî¦îÏî»îƒî ^î ®ï[Hî!î¥î‚î¬î wî#’î$¼î'Ìî*šî,î-/î2©î4bî6Âî:Vî<î>nî ®ïXÅî†î–îòî îIîCî ïî%Âî ®ïVÑîkîaî×î¸îýî ·î" î&tî+Oî-ìî.ûî2• î94î<�î?®îAAîCÿîÐïU*îËî!îzîNïU*î¾ïU*îvî!ïU*î"FïU*î(pî,î-´ î5 î=.îAh îÐïSƒî] îˆî"·î$ù î-%î/áî3n î;wzî@OïSƒî@êïSƒvîF4ïSƒîF®ïSƒîÐïQÛî¾ îÛ î($ î/†î:´î?*î@þîDÍîGžîÐïP4î·îîÜî‡î"oî#–î'<î+hî1î4 î5vî7èî9Àî=Ÿî@¬îBWîEîGÌî ®ïNAî•î.îNîÉîMîhî!sî&¯î)@î*yî/“î2qî5éî7éî=Fî?Qî@ŠîB·îDîH#îÐïL™îÛîàîáîÇî$½î(î*Zî.¶î1±î6éî8‚zî<§ïL™î=WïL™vîBGïL™îCPïL™îÐïJòîÍî²î Øî$ î&k î-™î0…î5kî84î>9î@îBŒîF'îÐïIK î îÎî"¦î&ˆ î.=î16î7î:7î?…îBQîDcîFãîÐïG£îÍî-îf î ®ïE zîXïE îÝïE vîïE îyïE îâîªî4îBî#¡ î)ôî+Ëî/ëî1ùî3Ðî7üî;aî=ßîAzîEîFíî ìïCyîðîî îaîUî"Zî(9î*œî.Ùî0•î2øî8äî:Sî<Ëî?²îAnîCLîF·î ìïAÑî]î“îIîoîTî¼î%uî)'î+ƒî/˜ î6Nî9î>þî@fîE…îH9î ìï@*îe îžî‹îOîÃî!+î#ˆ î+öî-¬î0 î7çî9“î<áî@QîBîDbî ìï>ƒî ¥îOîýî\îEîÝî~î ®ï<î]î�î¿înî_î"î#Ãî%¹ î,,î/Lî0|î3éî5qî6 î9¶î;( îBƒîEðî ìï:Xî î'îÑîˆî î ¥î#Ôwî%�ï:Xî&Uï:Xvî*oï:Xî+Jï:Xî-9î2Bî6éî:‘î<Íî?+ îFî ìï8±î zî’îî�îhî¹î!”î$î+aî/pî2î3Œî6:î8M î?jîB¨îD»î ìï7 î‹î„î{î îÔî$zî&üî,?î2¹ î:Àî?_îC îD»î ìï5bî Ôîg î‘ î!qî%8î*4î-î0å î8�î<¬îAîC•îGàî ìï3»îWî+î� îŒî!Dî"µî' î/3î2î6Ôî99î>uî@ïîDRîG“î ìï2î Kî ®ï/�î°î…îMîî î&`zî()ï/�î(Ãï/�vî+Rï/�î,Hï/�î0dî2Òî5a î§îA‹ î ìï,BîîºîîàîŒîZî" î(Oî+Nî0~ î7î=`î?IîCÿî ìï*šî¥î.îÀî, î#.î%( î,Mî/|î2ªî5€î7Yî:[î=öî@ÌwîFOï*šîG7ï*švî ìï(óî Xî”îBîEînîþî 4î!âî# î&ªwî)bï(óî*ï(óvî,Ëï(óî-:ï(óî.yî2ÿî ®ï&pwîŠï&pî›ï&pî˜vî.ï&pîÔï&pî"Ãî&ôî+•î0Lî2 î4l î=gî?$îCVîDóîGVî ìï$Èwî&Žïûî+ ÿ =TVm$LCEDARLANGUAGEOVERVIEW12FromMesatoCedarTheCedarLanguageisverycloselyrelatedtoMesa.Themostradicalchangeistheprovisionofautomaticdeallocationofdynamicstorage,orgarbagecollection.Severalotherchangesextendtherangeofbindingtimesavailableforsuchimportantattributesasthetypesofvariables.ItisintendedthatmostCedarprogramswillbewritteninthesafesubset,whichimposesanumberofrestrictionsnotpresentinMesatoensurethesafeoperationofthegarbagecollector,andintroducessomenew(safe)featurestomaketheserestrictionstolerable.Thefull(unsafe)languageisgenerally"upwardcompatible"withMesa.Garbagecollection,collectiblestorage,andREFsAlthoughMesapointersaretyped,theyprovidearichsourceofopportunitiesforcreationofsafetyproblems,includingtheclassicaldanglingpointerproblem,whereapointerisusedafterthestorageitreferstohasbeendeallocated,andtheoppositestorageleakproblem,wherestoragebecomesinaccessiblewithoutbeingdeallocatedforreuse.FreeingtheprogrammerfromresponsibilityfordeallocatingstorageatjusttherighttimewasamajorgoalofCedar.ItaddsanewclassofREFtypesthatarejustlikethecorrespondingpointertypesexceptthatthesystemisresponsibleforfreeingthedynamicvariablestheyrefertoaftertheyhavebecomeinaccessible.Cedarprovidesthreetypesofstorage:Frame:Thisisstoragethatisimplicitlyallocatedbyaprocedureapplicationoranimplementationinstantiationtoholdvariablesdeclaredinthecorrespondingscope.Itisalsoimplicitlydeallocated,uponexitfromthescope(e.g.,returnfromtheprocedure).Collectible:ThisisstoragethatisexplicitlyallocatedbyNEW,andimplicitlydeallocatedaftertherearenomoreaccessibleREFstoit.FREEappliedtoaREFvariablewillcauseit(andREFfieldsinthedynamicvariableitrefersto)tobe"NILedout,"butthedynamicvariablewillonlybefreedwhennootherREFstoitremain.Heap:ThisisstoragethatisexplicitlyallocatedbyNEW,anddeallocatedby(unsafe)FREEstatements,asinMesa.Heapstorageisreferencedbypointers,whichmaynotbedereferencedincheckedregions,andshouldnotrefertodynamicvariablescontainingREFs.TheintroductionofcollectiblestoragehassubstantiallyrevisedprogrammingstyleandinterfacedesigninCedar.Whentheprojectwasbeingcontemplated,someMesaprogrammersindicatedthatasmuchas40%oftheirtimewentintodesigningandcheckingthecodetoavoiddanglingpointersandstorageleaks,totrackingerrorsinthiscode,andtowastingtimeintrackingothererrorsbysuspectingstoragedeallocationproblems.WithREFsandareliablegarbagecollectorthatallgoesaway.Frame(static)variablesarestilllessexpensivethandynamicvariables,sinceentireframesareallocatedandfreedonprocedureentryandexit(andthemechanismfordoingithasbeenrathercarefullytuned).However,itisentirelyreasonabletousedynamicvariablesfordatawhoselifetimeisnotcloselyconnectedtoaparticularprocedureapplicationormoduleinstance.Objectsoflargeorvaryingsizearealmostalwayspassedacrossinterfacesbyreference.Definitivemeasurementsonthecostofgarbagecollectionhavenotyetbeenmade,butpreliminarydataindicatesthatitisgenerallylessthan20%.Onlyinveryspecialcircumstancesisheapstorageworththeaddedprogramcomplexityandpotentialforerrors.SafetyAdesirablepropertyofahigh-levellanguagesystemisimplementationindependence.Thismeansthattheeffectsof(evenerroneous)programscanbeunderstoodintermsofthelanguageratherthanrequiringanunderstandingoftheparticularimplementation.MesacomesratherclosetomeetingthisCEDAR4.2vîØïgwîÕïgî �ïgvî#ïïgwî$×ïgvî+µïgwî,ÈïgsîG~ïgxî ìï^õî]îêîûvî ®ï[¦îžîÏî2î·îßî#rî(î)äî-ýî0îî4dî8øî=¹î?=îAµîGÖî ìïYÿî? îæî›î&î$-zî%íïYÿî&�ïYÿî*þ vî0‡ïYÿî1_ïYÿî6.î9Éî>ñîCiîEÄî ìïXWzî ¥ïXWî UïXWî~vî ïXWî°ïXWîÅîî4î%• î+ªî-Yî/¸î3Lî5 î ®ïUÜî"îŠîCîîhî}î%�î(5î*"î.Òî0}zî2ÙïUÜî3^ïUÜî5™vî9ïUÜî9óïUÜî=þîC<îDbî ìïT5î « î¬î'îîµîdî!î%ƒî'éî*»î0ëî2©î5î:5 î@#îBà î ìïR�î ­îÈîµîîëîÍî#„ î*­ î0âî3èî6¡î<îBîC¨î ìïPæî� î_îzyî ìïM—îo î îœî!Ç|î$gïM—î%2ïM—yî&›ïM—vî ®ïJHîÆîiî°îýî"&î%0î*4î+Xî.î2hî4 î<}î>´îCðîE£î ìïH îbîŒîzîNïH îÿïH î#ívî(™ïH î)`ïH î.‹î2¹î3øî8×î:Xî=ªî@ûîCqîH9î ìïFùî ¬îFî¦îí îdîî!Pzî&ÀïFùî'DïFùî+Tvî.8ïFùî.ÿïFùî3ÿî8î< îB% î ìïERîðî´ îßîî î%î'i î/Dî2£ î;î=C îDÝî ìïCªî �î7îŸîùî'îÜîî î"î#Ïî(Gî)Çî- î.>î15î4mwî6/ïCªî7ïCªvî8æïCªî9UïCªî<ƒî?YîAµîD_îGî ìïB îåî¯îEî—î"hî$Éî)Fî*´ î1èî4'î8Ðî;1î@ÂîFî ìï@\î =zîìï@\îœï@\vîï@\î�ï@\î.îuî‹ î ®ï=àîÆîUîÞîrî+zî ®ï;òvîvï;òî^ï;òî™îîÉî î î%<î+ î-î.Cî4Ï î;êî=·î?° îÐï:K îúîúî|î$ˆî*_î,^î/ î8Xî<Ìî>•î@RîCp îÐï8¤ î[îðîœî"î$bî(-î+ˆî/·î3î5} zî ®ï6µ vîÛï6µîÂï6µîùîhîîðî!` î'Kî-wî/ï6µî/þï6µvî1Ñï6µî2²ï6µî5m î;� îBÆîFîÐï5îîî” wîÆï5îšï5vî! ï5î"ï5î#¨î%Hwî&0ï5î'ï5vî(Õï5î)zï5î-²î/Swî0oï5î1Cï5vî3ï5î3Äï5î8=î:Úî>‚î?ËwîBîï5îCÂï5vîE“ï5îF ï5îÐï3gîvîÍîTî‚î Ðî$�î&¼î(bî*Kwî*ûï3gî+äï3gvî-ï3gî-¬ï3gî.ïî2eî4Ýî74î<¼îAêîD�îGžîÐï1¿îdîîwî¾ï1¿î’ï1¿vî ï1¿î! ï1¿î"»î$zî ®ï/Ñvî³ï/Ñîšï/Ñî¯îýî‘îBî� î#Yî)wî*àï/Ñî+Éï/Ñvî-œï/Ñî.[ï/Ñî0ô î8 î9èwî?ï/Ñî?Ðï/ÑvîBhï/ÑîBíï/Ñ îÐï.*îeîùîáî}î î!i î(î)öî/‚î3wî6aî8½î:” îB¬îDAîÐï,ƒîðî§î#î˜î"éî$˜î*'î/â wî6›ï,ƒî7oï,ƒvî8áï,ƒî9fï,ƒî ®ï*î¶ îÀîª î ]î%@î'æ î/úî4Ý î= îAîCéî ìï(`îHîî€î¥îî»î"tî&L î/;î2Ûî6‘ î?îEîGáî ìï&¹î Ùîžî¢îqîÎî î}î!kî'«î*yî0Kî2Áî6î7ãî;¹îAtîFØî ìï%î§îzî1î‡î†î=î!çî%�î(Pî*î/î22î3éî9?î<çî@æîBë î ìï#jîž îJîªwî (ï#jî üï#jvî"nï#jî#wï#jî&.î'Xî,Aî1bî6ñî9Àî;°î>Éî ®ï ïîWîîî¯î!•î$oî*þî.hî4< î:”î>KîB|îG;î ìïGîšî8î³î î î!„î$"î&µî)Íî,î3-î5Qî9î:Vî<±î?õîCêî ìï î¨îÚî.î˜î• î#aî%î'€î-î2Æî5î8î<0îA8îB¡îEî ìïùîuî)îX î“î  î'3î(ýî.î3­î8§î:fî=Óî?œîDŠîG;î ìïQîˆî$îÂî zî"gïQî#ïQî$yvî)µïQî*ÈïQ î1v î:¤î<âî?yîB~îDnî ìïª îîVîÂîîVîfî!Þ î)>î,:î1ãî4¨î5öî7Yî=6î?ÃîBàîFî ìïî Çîî¬ î�î(î!²î&’î*¶î-Cî1”î7P î>„îAhîGRî ìï[yî ìï vî ®ï½î[îMî îãî- î#¯î)–î.2zî/¾ï½î0"ï½ î9] vîAï½îBï½îEKî ìï î Æî1î�îRî î î&!î(¸î*µ î1ôî3­î7„î9Izî;´ï î<ï vî@ïï îBOï îFiî ìï nîî î*îýîv î%Æî0î3Ùî8!îNîCZ î ìïLöîLînîÄzîÍïLöîRïLöîÁvîøïLöî³ïLöîâî$,î%Éî+Šî.‰î1Ÿî3‰î6î<î@[îCÓî ìïKNîÜî5î¢îšîÖî#�î)¤î+:î-w î3;î5ðî8›î=ðî?†îC|î ìïI§î™îºîžîÌî:î#äî%Ãî(Sî+Qî0î3Iî7‘î:óî=™îBÔ î ìïHî_ î5î�î]îíî Àî%aî)×î/vî1Uî5ˆî;2î¤îB“ î ìïD±î †îîÌî îÔî!,î&žî(á î/; î7�î9,î>©îA[îDÇî ìïC î ¥îî“îšîîîÞî$Wî&î(pzî ìï?»îZî‹î.vî ®ïÅîAñîCÓî ìï,¶îJîW îQî�î#_î& î3.î5v î;Fî<èî?©îA`îFî ìï+î ¥îîîgîÓwî ®ï(Ûî‘ îÖ}îÞï(Ûîhï(Ûwî™ï(Ûîjï(Û }î&qï(Ûî&ïï(Ûwî*Fï(Ûî+;ï(Û}î-¿ï(Ûî.^ï(Ûwî/sï(Ûî0hï(Ûî2f}î5mï(Ûî5Êï(Ûwî7mï(Ûî8>ï(Ûî9äî>Uî@~îEÄî ®ï'zîÑîý îUîvî ®ï$ÿî3îoî î§î° î#cî% î(iî)Œî-œî0™î2‚î7éwî:üï$ÿî;Çï$ÿvî@·ï$ÿwîAŒï$ÿîBEï$ÿvîFöï$ÿîGËï$ÿwî ìï#Wvîuï#Wî ®ï!iîŠîæî‚î°î*) î12î7Šî;Ûî=kî>¢îBoîCèîÐïÂîîVî2îÿî"'î% î+½î.Îî0Íî4oî6Üî:©î> îE‹îFÂîÐï îRî î!î&•î(Cî*£î.cî0¶î5Sî7î ®ï-î?î#îôîPî$cî&î+Þî.Fî2; î8çî;qî=ÙîD-îGžîÐï…îØîD îŠî!¤î$×î'Bî,!î-°î.æî2²î4* î;jî?Ñ îF‹îÐïÞîÿîy î9î×î#Öî'qî) î0?î2,î9Pî;~î@ îFØîÐï7 îÈî>îÞî!.î$ßî'$î+³î-Rî1õî8Fî;~îBKîGîÐï�îØîgî{î!Lî$0 î+oî/á î6§î;:î=Cî@–îCÈîFîÐïèî®îeî€î8î ®ïúîYîîôîîî!›î& î-8î/Øî1Mî2×î8…î:RîAVîCeîÐïSîÀîNî<îZ î"^ î)#wî* ïSî*ÞïSvî/@ïSî/£ïSî0Íî2 î:î?ïîBßîG}îÐï«îîîyî �î#Dî), î/®î0Øî5Sî8ƒî:<î ®ï 0îgîxî‡ îçî#\î'kî)Øî/ùî53î8ˆî;òîAÈîCWîD�î ìï ‰î Tî¾wîÕï ‰î ï ‰vîæï ‰î¿ï ‰îáî=î$±î(mwî)Õï ‰î*Ÿï ‰vî/öï ‰î0œï ‰î2ªî4– î:¼î= îB—îDBîF/wî&Žïûî+  ÓTVm$ECEDARLANGUAGEOVERVIEW14otherwise,theoutermostblockisUNCHECKEDandallinterfacesareassumedtobeunsafe.Thecheckingattributeisinherited;unlessanestedblockisexplicitlyprefixed,itischeckedoruncheckedlikethetextuallyenclosingblock.Ifasystemconsistsentirelyofsaferegions(andtheinvariantsholdinitially),thenbyinductionthesystemisinvulnerable.However,anerrorinanuncheckedregioncanmakeeventhecheckedregionsvulnerable.ThustheCHECKED/UNCHECKEDboundarylimitsresponsibility,butnotvulnerability.Confidencethaterrorsincheckedregionswillnotcausesystemcrashesisbasedonthetheautomaticenforcementofsafetyrestrictions.Confidencethatuncheckedregionswillnotcausesystemcrashesisbasedontrustthattheyarefreefromerrorsthatviolatethesafetyinvariants.Caveat:TheconversionoftheCedarsystemtosafeinterfacesispresentlyunderway.Theunsafeinterfacesarebeginningtodisappear.Youshouldprogramassafelyasyoucan,butdonotbesurprisedbytheinitialdensityofsafetycomplaintsfromthecompiler.AgoodruleistoprefixeachmodulewithCEDAR,andthentoputTRUSTEDoneachblockaboutwhichthecompilercomplains,afterconvincingyourselfthatthecomplaintisnotyourfault,becauseitresultsfromanecessaryuseofanunsafesysteminterface.ThereasonforeachTRUSTEDshouldbedocumentedinanaccompanyingcomment.TypeconfusionMesaisastronglytypedlanguage,whichmeansthatthetypesofnamesaredeclared,andthatthelanguageimposesrestrictionstokeepvaluesofonetypefrombeingaccidentallyinterpretedasvaluesofanother.Becauseknowledgeofthetypestructureofvaluesinmemoryissoessentialtothegarbagecollector(itmustlocateandfollowREFsinordertodeterminecurrentstorageusage),itisparticularlyvulnerabletoanyoperationsthatcausedatainmemorytobeinterpretedashavingotherthantheirtruetypes.Thus,muchoftheeffortindesigningthesafesubsetwentintoidentifyingallthefeaturesinMesathatallowtype-checkingtobecircumvented(accidentallyordeliberately)anddesigningsafereplacementsfortheimportantusesofthosefeatures.LOOPHOLEisa"typeconverter"inMesathatallowsanyvaluetobetreatedashavinganyspecifiedtype;itisthemostobviousbreachoftypesecurity.Itcausesasafetyproblemonlyifitallowsmistypeddatatobestoredintomemory(i.e.,ifthetargettypecontainsanaddress,suchasapointerorprocedurevalue);otheruseswillintroduceimplementationdependencies,butnotthreatensafety.Withincheckedregions,LOOPHOLEisnotallowedtoproduceavalueofareference-containing(RC)type.NarrowingandtypediscriminationCedarintroducesanumberofnewtypedistinctions,frequentlyleadingtoanumberofseparate,butcloselyrelatedtypes.Itisoftendesirabletocoerceavalueofoneofthesetypesintoavalueofarelatedtype.Wherethetypesaresuchthatitcanbestaticallyguaranteedthatnoinformationwilleverbelostbythecoercion,itiscalledawidening,andisperformedautomaticallywheneverdemandedbycontext(e.g.,assigningaboundvariantvaluetoavariantrecordvariable).Ingeneral,conversionintheotherdirectionrequiresaruntimechecktoensurethatinformationisnotbeinglost.Tomakethepossibilityofsuchfailureexplicitintheprogramtext,theNARROWtypeconvertermaybeapplied(andmayincludeacatchphrasetohandletheNarrowFaultexception).Thebuilt-intestISTYPEcanbeappliedtoavaluetodeterminewhetheritcanbenarrowedtoaspecifiedtypewithouterror.Ifso,itissaidtosatisfythetype'spredicate.Ifthetargettypeofanarrowingisuniquelydeterminedbycontext,itneednotbeanexplicitargumenttoNARROW.DelayedbindingCEDAR4.2vîØïgwîÕïgî �ïgvî#ïïgwî$×ïgvî+µïgwî,ÈïgsîG~ïgvî ìï_/ îeî»î)îàwîCï_/î(ï_/vî&.ï_/î&Ôï_/î(Ýî*Ä î0åî3/î8µî:[îîA î ìïTn îUî8îCîîiî$Fî'î)�î-Zî1êî6½î8>î<4î>Oî@ÄîC8î ìïRÇ îøîÎî× îG î&¸î)¤î0�î5‚î8Kî:Ýî>¯îCHîH#î ìïQ î ÍîÔîîÓîãî7îî!kî%aî(/î,Ÿî.þî2ê yî ®ïN¤vîËïN¤î³ïN¤îÁ îÄîšî î$Mî(æî*²î-� î3åî5nî;sîB?îE4î ìïLü îî`îÇîp î øî$î(yî.î/¬î3ˆî51î7ãî:Âî=>î?@îA°îCœî ìïKUî çîEî0îíî¥î‘ î#€î&æî)Eî/Wî0ãî4Tî7+î8–î:Dî>EîAuîFtwî ìïI®vî ýïI®îêïI®î²îèî§wî8ïI®îñïI®vîïI®îÔïI®î!/î$pî(Aî,3î0Qî2Áî8Œ zî?wïI®î@'ïI®îBº î ìïHîþîÖî'îhîÚîCî!dvî$ïHî$õïHî*î+yî/Îî3;î4kî:„î<ÿî>½î@³îEî ìïF_ îéîÁîîXwî‰ïF_îBïF_vî"]ïF_î"áïF_î&Ùî(Ê î0£î2Qî4A î=Czî ìïCî Hvî ®ï?¿î[îËîùî>îî"<î&Nî*–î-hî/Ìî3dî5!î9iî;ÀîA¢îD]îG/î ìï>î¬îç îÝî…î Ðî$øî&«î)Pî,Zî/»î3€ î:ú îBîC®îGÖî ìï˜îAH î ìï4,î )î‰îêîãîœî;î ®ï1°wî •ï1°îqï1°vî�ï1°îðï1°îðîîÈ î ƒî"(î%Èî(�î,²î/Iî2êî4�î6wî; î<°îA#îCºî ìï0 î pîÀî'î�î×îóîiî!î$'î)�î+î/6î0Zî4@î9¿î<Óî>.î?îC§î ìï.aî æî‰înî†îSîµî·î! î#`î'6î*;î/“î1xî6¯î9Õî;xî<–îASîC î ìï,ºî�î5î5îçî î'ý î0Úî3bî5Þî;Hî?’îDAî ìï+wî ï+îÅï+vîÄï+î(ï+î0î¥î»î iî%Âî&ìî*•î,Nî-xî:$î=¢zî ìï'Ãî§îJî/ vî ®ï$sîâ î®îôî=î î#î&J î-ý î4¾î9®î;yî<ÀîB îCÞî ìï"Ëî }îîªî¦î-î©î Mî&.î'íî,Aî-{î15î2þî5ºî7ƒî;î>ÀîA¨îBâîFœîHeî ìï!$îƒîïîoîÓîlîÄî!úî$Íî&(î(¸î*­ î0W î7nî:Aî› îE�îG/î ìï.î ÂîÀîDî¤î î$+î&î*¬î-± î5rî7î9Áî=Âî@æîCDîG/î ìï‡ îlî$îTî­î€î ,î"‹î(î+'wî-…ï‡î.mï‡vî3Hï‡î3·ï‡î6Wî6î@BîF|îHEî ìï¼î¨î¸îÄî�îî+î �î!íî$Åî&tî*¢î-zî0íï¼î1žï¼vî6'ï¼î ®ï@î_îîîÿî?î'î�î"<î#Øî)à î1<î3gî8Äî:Iî=Öî@zîB›îD»î ìï™îwîÄï™î­ï™vîï™yî ìï Iî8wî&Žïûî+  ­TVm$CEDARLANGUAGEOVERVIEW15Adesirablepropertyofahigh-levelprogramminglanguageisthatisallowawiderangeofbindingtimes:thatis,itshouldallowtheprogrammermaximalcontroloverwhentheattributesofaparticularvariablearedetermined,withdifferentchoicesnotrequiringchangesinallexpressionscontainingthevariable.Examplesofsuchattributesareitstype,storageallocationmethod,implementation(forabstractobjects),andactualvalue;examplesofbindingtimesincludeprogram-writingtime,compilation,configurationbinding,programinitialization,blockentry,andstatementexecution.Generallyspeaking,deferringthebindingofanattributeleadstogreatergeneralityintheprogramatthecostofdecreasedstaticcheckabilityand(often)lowerruntimeefficiency.ExperiencewithlanguageslikeLISPandSmalltalk,inwhichmostbindingisdonedynamically,showsthatitismucheasiertowritecertainkindsofprograms,iftypeand/orimplementationbindingcanbedeferred.Programmingtools(debuggers,performancemonitors)andknowledgerepresentationsystemsaretypicalexamples.Butfewprogramstakefulladvantageofthisflexibilityveryoften.Cedarwasdesignedtotakeadvantageofearlybinding,asMesadoes,buttoallowcertainbindingstobeexplicitlydeferred.Dynamictyping,REFANY,anddynamicallytypedprocedurevariablesMesaprovidesverylimitedvariabilityinthebindingtimeofanobject'stype.Variantrecordsallowadeferredchoicebetweenspecificenumeratedalternatives,andsequencesallowdeferringthespecificationofanobject'slengthuntilitisallocated.Otherwise,alltypesmustbestatic.ThismakesitvirtuallyimpossibletoavoidLOOPHOLEsandadhoctypetaggingschemeswhenwritingschedulers,sorters,outputformatters,etc.thatmustoperateonobjectsofunpredictabletype.Cedar'ssolutiontothisproblemrequirestwonewmechanisms:aruntimerepresentationfortypes,andawaytoassociateatypewithanobjectatruntimethatisguaranteedconsistentwiththetypesystemandstaticchecking.(NotethatCedaradoptstheviewthatanobject'stypeisinherentintheobjectitself,ratherthaninthewaytheobjectisreferredto.)TYPEisatypeintheCedarLanguage.The"structuringmethods"(e.g.,ARRAY,RECORD,andREF)areviewedasoperatorsthattaketypeargumentsandreturntypevaluesasresults.Inthecurrentlanguage,theargumentstosuchoperatorsmustbestatic(compile-time)constants.ANYisnotatypeinCedar,butcanstandinplaceofatypeintheargumentstotwooperators:REFandPROC.AREFANYvaluemayrefertoadynamicvariableofanytypewhatsoever.ThusaREFTvalue,foranyT,canbewidenedtoaREFANYvalue.ButaREFANYvaluecannotbedirectlydereferenced,becausethetypeoftheresultisnotstatic.ThediscriminatingselectionstatementhasbeengeneralizedtoallowdiscriminationonthereferenttypeofaREFANY;withineachselectablestatement,thetypeis(statically)knowntobethetypespecifiedinitstestitem.NARROWcanalsobeusedtosafelyconvertaREFANYvaluebacktoaREFTvalue;ISTYPEcanbeusedtocheckwhetherNARROWwillsucceed.APROCtypemayalsohaveANYinplaceofthetypeofitsformalparameterrecordtypeand/orresultrecordtype.PROCvalueswithspecificdomainsandrangesmaybewidenedtothesedynamictypes,andlatertestedandnarrowedanalogouslytoREFANYs.Theymustbenarrowedbeforebeingapplied.Inprinciple,eachvalueinCedarcarriesitssyntactictypewithitatalltimes.Inpractice,almostallanalysisandcheckingoftypesisdonebythecompiler,andbothspaceandtimeefficiencyaregainedbynotstoringconstanttypeswithvalues.However,thesymboltablesproducedbythecompilercontainenoughinformationtorecoveranytypeondemand,madeavailablethroughastandardpackage.RuntimeTypesprovidestype-conversionroutinesinbothdirectionsbetweentypedvalues(withtypeRTTypesBasic.TV)andordinaryCedarvalues,andnumerousoperationsontypedvaluestoexaminethetypeandstructureofatypedvalue,tochangeitsattributes,etc.ThusitispossibletowriteaprogramCEDAR4.2vîØïgwîÕïgî �ïgvî#ïïgwî$×ïgvî+µïgwî,ÈïgsîG~ïgvî ®ï_,î<îî­îiî• î"ø î+�î1Vî2Äî5”î7î:®î;Úî?.îBûzîD¶ï_,îEfï_,î ìï]…vî üï]…îkï]…îÕî£îîŠî>î¨ î&”î,8î0õî4î7Øî:B î@bîB%îCY î ìï[Ýî=î« îhî�î"]î'Aî)Ñî/éî50î6ùî9 î@[ îG/î ìïZ6îkî›îEîh î nî"³î$~î'Øî,{ î2«î8 îAÐîDxî ìïX�îÁîàîIîÓî"7î$Wî)Ôî-äî3+î=ÇîA¬ î ìïVç îiîâî|î%Áî)Œî-‚î0Dî6… î=îC‡î ìïU@îæîLîjî*î"î ºî$?î%õî*˜ î0õî2«î5î:§î®îAƒîCCî ìïS™î v î îÄîJî î%L î ®ïQ îùîCî¼î —wî!~ïQî!èïQvî#¿ïQî$dïQî&¥ î-@î/î3Zî6åî<+î=ÅîAg î ìïOvîîÞî?î·î™î…î>î Çî%Zî)î*Þî1Uî2Áî5Üî:� îDyî ìïMÏî •î£î� îWî Æ î(B î0dî6Áî9–î@˜ î ìïL'îöîUîÑî0îÝî!ˆî'¦î*ªî-@î3Âî5†î83 î>gîA�îEwî ìïJ€î Æî°î�îµîZî Bî#×î)tî+Qî/(î2ßî5�î7lî;Cî?øîEÁîGžî ìïHÙ îÔzî ìïE‰î¬{î!ïE‰îìïE‰îÈzî;ïE‰îïE‰î» î$4î'Éî-õvî ®ïB:îRîÝîçî• î$î%±î( î-î0>î1òî3Þî8Ïî<2îAîEæî ìï@“î ïîMîlî´îx î%Ý î-Mî/Ýî6$î9¦î?rîA« î ìï>ëî Ñî îîîvîêîlî î$O î+Vî-rî13î4Èî6åî:óî>9îBžîD!î ìï=D î©îEwîòï=Dî«ï=DvîAï=Dî7ï=DzîÜï=Dî �ï=Dî!¯vî$*ï=Dî$˜ï=Dî''î+éî1:î4Ýî9} î@rîEî ìï;� îÜîgî5î�î‡î Žî%+î&ä î/�î ®ï9!î§îíî¡îGî Ðî&"î(Òî+Å î3úî5)î:e îC`îE¢î ìï7zî “î «îrîî¥î¾î½îÇî ¦î$®î&6î+\î.î/u î6v î<¼î?ÆîBîEî ìï5Óî ”îîîõî´î ½î%î'eî*‘î-Pî/2î4î7î8vî=áî?€îAÐîEÚî ìï4+î úî îÎî-îîdî}îéî%+î ®ï1°wî •ï1°îhï1°vî3ï1°î–ï1°îžîÈî×î…îäîüî$�î'u î/î5Wwî8±ï1°î9„ï1°vî<Óï1°wî=¯ï1°î>ƒï1°vîB�ï1°îCzï1°wîF1ï1°îGï1°vîHwï1°î ìï0î îfîTîœîªîãî#2î* î-î1†î4Õî9Cî;1î@îB&îDÅî ìï.aî îjîîÆîøî$î'hî)Yî,ã î6' î ®ï+æwî ¶ï+æîžï+ævîÒï+æî6ï+æî3î�î»îÀîbîÇî =î"½î&\î'ÿî+‡î-5î.Sî1Xî2ûî5Oî;òî=•î@6 wîF¬ï+æîG€ï+ævî ìï*>wî £ï*>î Kï*>vîÆï*>î ®ï'Ãwî;ï'Ãîï'Ãîìvîæï'Ãî—ï'Ãî‘î–îèî˜î Âî&Sî+‹î-Eî/æî2÷ î:lî=ëwî?ï'Ãî?êï'ÃzîAÇï'ÃvîC4ï'ÃîG7î ìï&zî vï&vî ^ï&î#î˜îrîàîxwî‹ï&î_ï&î)vî ï&î Àï&î#ûî&…wî'™ï&î(lï&î*6vî-ï&î-Îï&î0±î5î6ðî;Ï îDAî ìï$tî Sîkî,î“îfîÚîWî@î" î+î0Ìî7 î9†î<ë îD0îEæî ìï"Í îáîÚî-îLîOî ûwî"ï"Íî"ëï"Íî$½vî'Mï"Íî(=ï"Íî,uî/™ î5Á î•îA˜îBö î ìï!&î{î3î.î—î°îvî-î!î#§î'-wî(Pï!&î)#ï!&vî-3ï!&î-Îï!&î/Èî2žî4™î7Þî9–î=€îBtwîC§ï!&îD{ï!&îF_vî ìï~î –îÝî‹wîµï~î‰ï~zîeï~vîÐï~wîôï~î]ï~vî Tï~î ïï~î"ßî$Ðî( î)ºî-œwî2êï~î3Òï~vî8®ï~î9¬ï~î;Yî ®ïwîOïî÷ïvîíïî\ïîî+î wîhïî<ïvî!rïî!Õïî#6î&ßî(­î+"î.Gî0î2î6‰î= îA…îDªî ìï[î ßîVîåwî¶ï[îŠï[vî»ï[îlï[îî!Sî&eî,î.ðî3fî6’î8ªî>Vî@,îCÝî ìï´î þîÚî%îBîî!b î)wî*Ùï´î+­ï´î-§vî06ï´î0»ï´î1»î5iî8öî; îAPîEÄî ìï î ®ï‘î{ î—îÆînîî!0î%ˆî'`î,ùî0î3 î4tî6 î7øî;÷î=ÄîC<îGŸî ìïêîî×î¢îjî îˆî" î$î&„î,¦î/mî2¸î6}î9CîûîD°î ìï›î) îîî8î!+î$Žî&çî,àî0òî7î<‹î>îCõî ìïô îoî<î#dî(ïî*Ûî.V î4ßzî:Œïôî:üïôî>`vîB­ïôîC&ïôîFî ìï Mî¦îVîÝî!íî&kî)î/ î6%î8#î;òî@îA¿îG/î ìï ¥î îÊî’îVî‹îmî zî"3î&æî(Ì î/Eî1Ûî5dî6Åî8<î=‰î?BîBËîDwî&Žïûî+ ÿ óTVm$ìCEDARLANGUAGEOVERVIEW16thatdealswithanygivenCedarvalueortypewithoutanticipatingthespecifictypewhentheprogramiswritten.ProgramssuchasBugBane(theCedardebugger)absolutelyrequiresuchflexibility.Thecurrentimplementationistooslowtobeusedeffectivelybyclientprogramsasasubstitutefortruepolymorphisminthelanguage,butissuitableforexaminingandchangingvariablesinteractivelywiththeCedardebugger.MiscellaneousAlthoughCedarwasnotintendedasaresearchprojectinprogramminglanguages,itsdeveloperswerenotimmunetothetemptationtomakeMesabetterinwaysthatwerenotstrictlyrequiredtoenablethenewprogrammingenvironment.Thissectiondiscussesafewofthesenewfeatures.TypesasclustersofoperationsEachtypehasanassociatedclusterofoperations.Themainpurposeofthisassociationistosupportastyleof"objectoriented"notation.Usingarecord-likenotation,aprocedure"field"willbelookedupintheclusteroftheobject'stype,andthenappliedtotheobjectandtheotherarguments.ItispreferredstyleinCedartousethisobjectnotationininvokingoperationsofinterfacesdesignedtosupportit.Consulttherelevantpackagedocumentationifindoubt.Eachbuilt-intypeandtypeconstructorinCedarimplicitlysuppliesastandardcluster.Theclusterextensionmechanismisthateachopaqueorrecordtypedefinedinainterfaceacquiresallproceduresdeclaredinthesamemoduleaspartsofitscluster.ROPEsandIOMesaSTRINGsareratherawkwardobjects,havingbeentunedforefficiencyinasmall-machine(Alto)world,ratherthanforflexibilityandconvenience.TheyarePOINTERstofixed-lengthsequencesofcharacters.Considerablecareisrequiredtoavoidsurprisingresults,evenforratherstraightforwardstring-processingapplications.CedarROPEs,ontheotherhand,aresomewhatheavier-weight,moreconvenienttouse,andlesspronetosurprises.Severaldifferentimplementationsofropes,efficientfordifferentpurposes,providethesameinterface.RopeisaCedarpackagethatsupportsthecreationandmanipulationofimmutablereference-countedsequencesofcharacters.Proceduresareprovidedforconcatenation,takingsubstrings,scanning,andotheroperations.Aclientcanprovidespecializedimplementationsforropeobjects.ThestandardimplementationattemptstoavoidcopyingwhenperformingSubstr,ConcatandReplaceoperations.TheRopepackageisthestandardsupportforsequencesofcharactersinCedar,.Mostofthecommonoperationsoninput/outputstreams,plusstringconversionsthatarecommonlyusedindealingwithinputorformattingoutput,havebeencollectedintheIOinterface.Implementationsareavailableforstreaminterfacestoallcommondevices,andtoallowropesandstreamstobereadilyinterconverted.LISTsandATOMsCedarincludesLISTOFasanewtypeconstructorforsingly-linked(byREFs)lists,andaconstructorforlistvaluesthatmimicsthatofLISP,avoidingtheneedforalotofNEWsorCONSs.TheanalogofLISP'sCARandCDRareprovidedbythestandardfieldsfirstandrest.UnlikeLISP,Cedarlistsarestaticallytyped(althoughtheelementtypemaybeREFANY).Cedaralsohasabuilt-intypeATOM,whichcanbeusedforvaluesthatareuniquelydeterminedbytheirprintnames.Anyropecanbeconvertedtoanatomandconversely;theadvantageofatomsisthat,CEDAR4.2vîØïgwîÕïgî �ïgvî#ïïgwî$×ïgvî+µïgwî,ÈïgsîG~ïgvî ìï_/î ÇîRîzî(îêîî!Æî#—î&´î+Í î3Pî5½î:´î=ÑîA“îDî ìï]ˆî Xîbî€î±î_î!;î$î(,î.¯ î51î9úî=+ î ®ï[ îƒîJ î'î�î!÷î%î&Åî(´î+í î2ƒî4|î8:î>Jî?öîA îGRî ìïYeî ì î+îöîrî ¬î#Jî$Òî*î,_î3(î5üî;õîAÍ î ìïW¾î îfî~yî ìïTo vî ®ïQ îçîîáîqî"Hî$î%Uî*Ôî/Œî1U î: î@¿îBµ î ìïOyî *î�îèîƒîÐ î®î!Jî$ìî(‚î,gî.î1Lî4î7Fî9¨î>îCŽîE)î ìïMÑî Kî9 îÌ î 2î#Lî'éî-°î.Úî1zî33î6½î9«zî ìïJ‚î Íî†î]î vî ®ïG3îî î�îu zîÚïG3îtïG3vî"$ïG3î"ßïG3î#Õ î*Òî-¢î1î6Rî8î:œ îAyîBÝîDƒî ìïEŒî î8îêî¬îÄî ‚î$}î%Ÿ î,ˆî2Hî3jî9æî>pîAîBþîG}î ìïCåî šî úî`îîxîmîÕî!�î$³î)�î+Lî-«î1Äî4{î6Ûî:z î ®ïAjîîrîkîŒî+î3îÒî"8î$Êî(Óî.2î/Ñî5q î<î=¹ îCÓî ìï?Âî šî¦îTîuîÔîî$Y î-¿î/ î0Îî ®ï=Gî+î î:îüî î%Iî'î+$ î1Mî6¥î7Ùî=~îBFîE)î ìï; îîaîÞî¾îî#òî%Èî*)î-Kî2]î4î5Yî;î@†îBˆ î ìï9øîqîî~îüîüîªî!î"Ëî$¥{î ìï6©zî ï6©îï6©{î»ï6©î7ï6©vî ®ï3[wî‡ï3[î&ï3[vîôï3[î-ï3[î±îïî"ðî(î,Áî0Nî4lî6Ù î=?î?î@w î ìï1³îîgîŠîÅî î"Vî%" î-\î0úwî3cï1³î4 ï1³vî8ï1³î9�ï1³î;a îC"î ìï0 î ¿ î� îîî–î%@î'î*â î1]î6î9~î;Öî?ýî ìï.eî© îÜwî!9ï.eî" ï.evî$Jï.eî$Îï.eî%ïî(:î*Þî.Âî2Ýî5uî<&îEüî ìï,½ îùîºî™îbî îî Ò î&ìî+Ñî1‰î;þî=ÉîAçîGRî ìï+î’î±î¼îî ˜ î ®ï(›îAî‹î“î‰î©îVî#Äî&î+"î-¸ î5þî7•î>Yî ìï&óîAîã î� îŠî!Æî'€î)¦ î2œî6² î=_îCPîEðî ìï%L î£îàîRîŽî!J î(áî3õî6ãî:Åî@jîCôî ìï#¥ îÀîFîéîžî#Àî'j î.‘î3/î7×î:„î?¼ îF·î ìï!ýî ¡îãîOî®îIî!Uî#“î)ÿî+¸ î2%î3Óî ®ï‚î&îÎîî¼ î Zî"O î*ˆî/Äî2­î6r î=Ëî@ˆîBËî ìïÛî î·îzî…î!îÕ î"‰î'Dî*{î-Èî3tî5wî7bïÛî7ÌïÛvî9ïÛî9iïÛî>óî ìï3î JîîVîÑ îî ¾î"¸î(rî-�î0_î2î5Ëî9ŠîbîAîB4 î ìïGî Aî—îÝîÃî˜î~îOwî 6ïGî  ïGvî!çïGî"ÛïGî(�î+î.yî0Îî2î49wî6 ïGî6óïGvî8ÆïGî9æïGwî;ÂïGî<�ïGvî>ñïGî?vïGî@iîCYîGÖî ìï wî Óï î =ï vî „ï î Üï wîï îäï vîï îÅï wî ï îÖï vî#ï îÉï î«î±î!áî$uî*Ezî..ï î.�ï vî11ï î1×ï zî4ï î4¡ï vî60ï î7Aï î<wî<íï î=Wï vî>žï î?¯ï îCûîFñî ìïø î’îiîžîþî!5î$Dî'Hwî)9ïøî* ïøî+évî.xïøî.òïøî ®ï }îÂîŠîûî îwîï }îæï }vî"�ï }î#eï }î'oî)öî+âî/î1Sî5}î8Gî:–î@N îG“î ìï Öî 'îƒîî î.î®î“î%Ýî'î)dî,Öî/� î6§î8úî?fîAîE îFhwî&Žïûî+  uTVm$�CEDARLANGUAGEOVERVIEW17unlikeropes,itisverycheaptocomparethemforequality;atomsmayalsohavepropertylists.Atomliteralsarejustnamesprefixedby$.CEDAR4.2vîØïgwîÕïgî �ïgvî#ïïgwî$×ïgvî+µïgwî,ÈïgsîG~ïgvî ìï_,î:î\îÇîHîlîyî=î#ìî'Šî)Ýî/®î3Åî6Þî9¿zî=ï_,î=Ëï_,îBvîD¾ï_,îE®ï_,î ìï]…î\î¯îQî•îîÿwî&Žïûî+ “TVm$rCEDARLANGUAGEOVERVIEW18ConvertingMesaProgramstoCedarJimMorrisThissectionassumesyoualreadyknowhowtoprograminMesa(orthatyouhaveaMesaprogramtobeconverted),andisintendedtoexplainthedifferencesforprogramminginCedar.SimpleprogramsLet'ssupposeyouwanttorunasimpleprograminCedar.IfanexistingMesa5or6programusesfairlyvanillastuff,it'seasytoconvert:Thenamesofmostinterfacesandsomeprocedureshavechanged,butthefunctionalityisbasicallythesame.ThemostobviousdifferenceswillbewithstringsandI/O.Youshouldonlyneedtoknowabouttwointerfacesforthese:RopeandIO,respectively.Ingeneral,theCedar/Pilotcommunityhasdroppedtheuseof"Defs"asasuffixfordefinitionfilenames,andintroducedthesuffix"Impl"forimplementationfiles;e.g."InlineDefs"became"Inline".Here'swhatyouneedtodotoyourMesa5or6program:ChangeallSTRINGstoROPEs(actuallyRope.ROPE).Removeallallocationsanddeallocationsofstrings.ChangeallreferencestoStringDefsroutinestouseRopeorIOroutines.Ropeprovidesprocedurestoparseandmanipulateropes.IOprovidesprocedurestoconvertROPEstonumbersandbackasnotedbelow.Onecannowputspecialcharactersinropeliteralsbyusingtheescapecharacter"\"."...\n..."insertsacarriagereturn(newline),"...\t..."atab,"...\\..."abackslash,and"...\123..."thecharacterwhoseoctalcodeis123.NoteaROPEisimmutable,unlikeastring.AppendingacharactercreatesanewROPE.Youshouldusespecificsubrangesfornumericvariableswheneverpossible.Ifyoudon'tknowtherange,useINT(32-bitinteger),unlessyouknowyoudon'tneedthatbiganumberandknowyouneedefficiency.InthosecasesuseINTEGERorNAT=[0..77777B].AvoidusingCARDINALSorLONGCARDINALS;theirmainuseisindealingwithSTRINGs.ThecompilerrecognizestheabbreviationINTforLONGINTEGER,BOOLforBOOLEAN,CHARforCHARACTER,andPROCforPROCEDURE.ChangeallreferencestoI/Opackagesofallkinds(streams,files,TTY)touseequivalentIOroutines.IOistheonlyinterfaceyoushouldneedtoknowaboutforI/Oofalmostanytypeofvariableorconstant(ROPE,INT,etc.)toalmostanytypeofdevice(keyboard,display,files,temporarybufferetc.).IOcontains:AsetofCreateXroutinesforeachkindofstreamXfile,display,etc.AsetofGetXroutinesforeachtypeX(integers,ropes,etc.)APutFroutinethatcanbeusedwithanytype(integers,ropes,etc.)viaasetofinlineprocedures(int,rope,etc.)whichareusedtotagthetypeofthearguments.ItalsoprovidesaformatargumentwhichmaybeusedtogetFORTRAN-styleformattingofoutput.Forexample,theformat"%g"printsalmostanythingindefaultfree-format:stream.PutF["Thesumof%gand%gis%g.\n",int[x],int[y],int[x+y]]APutFRroutinethatisidenticaltoPutFexceptitproducesaropeasoutputinsteadofputtingitsresultonastream,andaRSroutinethatmakesaropelooklikeastreamsothattheGetXprocedurescanbeused.Thusonecanconvertvarioustypestoandfromropes,e.g.thefollowingcodewhichconvertsanintegertoaropeandback:r:ROPE_PutFR[,int[i]];j:INT_GetInt[RS[r]];MakeuseofLISTsandSEQUENCEsinsteadofARRAYsandDESCRIPTORsforARRAYs.TheinterfaceListcontainssomeusefulroutines.CEDAR4.2vîØïgwîÕïgî �ïgvî#ïïgwî$×ïgvî+µïgwî,ÈïgsîG~ïgxî ìï^õ îKî×îHî Yyî%(ï^õî' ï^õî)Ãvî ®ï[¦îÁîWî�îNî!î$Óî'Ñî)yî/î0©î4Kî6‚î9Jî;úî?:î@]îDî ìïYÿî šî ‹ î³îjîÖî’î Aî%î't î.oî0¬ î9?î:íyî ìïV°î|vî ®ïS`îîHîüîWîî—î ¾î%!î*­î,Yî0Æî2Fî44î9<î<ãî>î?×îA îF–î ìïQ¹î Šîúîƒî¶î¹îhî ®ïOËî‹îÔî’îó î"î!Þî%w î,ƒî/Îî5›î8!î:… îB�îDîÐïN$î/î ®ïL5î›î îB îSî"î$î'Jî+¹î.†î1¿î4ãî9tî<£î@îAÙîE­îÐïJŽî| î¦îãîæî#›wî&RïJŽî&¼ïJŽvî'˜ïJŽî(uïJŽ î ®ïH î|î¦î îŽî$Ëî'?î,Ãî/"î1–î3Nî7õî9¢î:Êî>Ÿî@Ü îG%îÐïFùîtî3 î-î!”î%rî*7î,| î6bî9Ñî}ï=™î?Qï=™vîBCï=™îB²ï=™îCËîÐï;òîŸîþîÄî½î!9î$Uî&øî*î,¬î1@ î7Åî9Šî<ÓîAZîCnîG/îÐï:Kî'î îxî î Ùî!²î#ªî$ƒî%[î&äî+0î,Wî1î5« î<î=œî>uî?Mî@íîAÆîBŸîD(îENîHîÐï8£î¾î¬î£î�î~îîX îâî"«î$Iî%7î&%î)}î*kî+Xî,÷î/hî5cî9£î=î@`îAÞîDÜîHewîÐï6üvîKï6üî®ï6üî· îôî!-î"Wî&„î-¬î.Öî4¾î9Eî:owî=]ï6üî>1ï6üvî ®ï5îÆîKîÉî½î"'î$mî)Úî/žî5Üî;~î= î?ÊîCgîG/îÐï3fîêwîWï3fîÁï3fvîÆï3fî@ï3fî/î#•î'¯î*^î.î0Äî4Pî7¥î:kî<Âî=ãîCîE·îÐï1¿î`î– îüî¤î"î%hwî'·ï1¿î( ï1¿vî-Aï1¿î-ýï1¿wî.Þï1¿î/Çï1¿vî1žï1¿î3]ï1¿ î:‘î>ŒwîBï1¿îBÚï1¿vîÐï0wî’ï0îKï0îf vîï0îtï0î!Jî$Åî'7î(¡î*Mî/wî26ï0î2Õï0vî7 ï0î7çï0î:¼î@u îGîÐï.p wî³ï.pîï.pvîï.pî˜ï.pwîQï.pî ï.pî!î'vî*‘ï.pî+ ï.pwî,Ãï.pî-|ï.pî3 vî6Ãï.pî7=ï.pwî8õï.pî9Àï.pvî@Úï.pîAï.pwîC…ï.pîD-ï.pvîG ï.pîG‚ï.pwîÐï,É vî ®ï*Ûî£î} îéî‚î8î#éî%Œî'fî+î0¶î3æî7¥î9=î;� wîB5ï*ÛîBŸï*ÛvîCÔï*ÛîDXï*ÛîÐï)4wîTï)4vî¢ï)4îúîGîMîàî!„î%íî)6î*Òî.~î2Mî4wî70î8Öî=(î?¶îB²îDXîÐï'Œî�îûwîuï'ŒîIï'Œî3vîìï'Œî’ï'Œî!íî#˜î'ùî*–î-¢î/Xî3™ î:oî?vîB¸îÐï%åîÿîZwîßï%åvî?ï%åîoï#÷îüîîÑzî²ï#÷vî4ï#÷î‚î!¿î$ðî( î)Ùzî.Iï#÷vî/Gï#÷î3iî8tîoï" îüîîÑzîï" vî‘ï" îÞî î#Mzî&]ï" vî'ßï" î-Ñî1Þîoï îÝî2îÝîŒîùîÌî"éî%æî(hî+Z î1.î5î8î:!î;,î=+î>ÆîBˆ î‘ïsîoîçîÛî Ùî#î&Gî'åî*î,mî/lî1î3c î:Yî;Àî>|îCúîEî‘ïÌî¨î¢î ’î"nî%—î'1î)f î4 î:Ëîî&õî)3î*žî/³î3žî7Šî=/îoïHîïî_îîÞî=î#Áî%cî(Éî- î.Wî4(î5Fî8jî: î>rîCîDÅî‘ï¡îhî/î1îVî!î#Îî$óî'Cî,î.Òî3î4,î7Xî:mî=î>:îB¦îDeîG/î‘ïúzîÏïúvîjïú î‰î!,î#5î&áî*wî-;î/Þî4àî9Àî=mî?3îBîE‚î‘ïRîîzîŒî!Óî%áî+Oî-@î1Üî3‹î4´î7åî:œî1ïdwî³ïdî‡ïdvîïdîÓïdî9~îBï¼wî£ï¼î ï¼~îìï¼îï¼ vî ®ï Îîžî$wîîï Îî§ï ÎvîJï Îîïï Îwîï Îî±ï Îvî"3ï Îî"–ï Îî&öwî(Àï Îî)“ï Îvî-Ãï Îî.hï Îwî0Šï Îî1pï Î vî8Ãï Îî9=ï Îwî;ï Îî;åï Îvî?�ï Îî@‰ï ÎîCrîÐï 'î’îõîˆî ¡wî&Žïûî+  TVm$}CEDARLANGUAGEOVERVIEW19NewlanguagefeaturesThechangesintheCedarlanguagefromMesa6arefairlyeasytounderstandforsimpleprograms:(a)REFsprovideautomaticdeallocationandeasierallocation:Node:TYPE=REFRec;Rec:TYPE=RECORD[first:INTEGER,rest:Node];...x:Node_NEW[Rec_[5,NIL]];(b)RuntimetypesviaREFANYgivelooserbinding:TNode:REFBlRec;Node:REFB2Rec;x:Node_...;t:TNode_...;q:REFANY;...q_t;q_x;--bothofthesearelegalt_NARROW[q];--raisesNarrowRefFaultifqisnotaTNode--q^_Eisalwaysillegal.YoucannotupdatethroughaREFANY....--typecanalsobecheckedexplicitly:WITHqSELECTFROMm:TNode=>{t_m;q_m.lson};n:Node=>{x_n;q_n.rest};ELSEERROR;--orIFISTYPE[q,TNode]THEN{t_NARROW[q];q_t.lson}ELSEIFISTYPE[q,Node]THEN{x_NARROW[q];q_x.rest}ELSEERROR.REFANYispreferredtotheuseofvariantrecords.(c)Listsarebuiltintothelanguage:Node:TYPE=LISTOFINT;x:Node_CONS[5,NIL];y:Node_LIST[5,6];--sameasCONS[5,CONS[6,NIL]]i:INT_y.first;--iis5z:Node_y.rest;--zisCONS[6,NIL]FORl:Node_y,l.restUNTILl=NILDO...(d)ROPEs,ATOMs,SEQUENCEs,andINTsarealsobuilt-in.(e)Toprotectyourselfandthegarbagecollectorfromobscureerrorsyoushouldprograminthesafesubsetofthelanguage.Togetaprogramintothesafesubsetprefixeachmodule(PROGRAM,MONITOR,orDEFINITIONS)withthewordCEDAR.Thecompilerwillthentellyouwhenyouarestrayingoutsidethesafesubset.YoucanwavethecompileroffanyblockbyplacingthewordTRUSTEDbeforeit.Ifyoucallaproceduredeclaredinanunsafeinterface(i.e.,onethatdoesn'tstartwithCEDARDEFINITIONS),thecompilerwillcomplainunlessthecallisinaTRUSTEDblock.Mostofthehigh-levelinterfacesintheCedarsystemarenowsafe.RestrictionsofthesafelanguageThe@operatorisnotpermitted.Therearethreegeneralwaystocopewiththisrestriction:specializing,copying,andindirecting.Forexample,supposeyouhaveaprogramthatsaysW:ARRAY[0..100)OFZ;CEDAR4.2vîØïgwîÕïgî �ïgvî#ïïgwî$×ïgvî+µïgwî,ÈïgsîG~ïgyî ìï_,î îÕvî ®ï[Ýî�î©îSî®zîÁï[Ýî$ï[Ývî"|ï[Ýî"õï[Ýî%Þî)ƒî*³î-î0œî3›î5E î¢îCî ®ïYïwîÊïYïîžïYïvîäïYïî«ïYïîïîE î$ñî'©î+‰ ~î€ïXGwîÈïXGî�ïXG~îïXGwîïXGîÙïXG~îµïXGî¾ïXGî‘ïV wîØïV î‘ïV ~î/ïV wîïV îéïV ~î!RïV î!ËïV wî$£ïV î% ïV ~î*”ïV î+ïV î-®î‘ïTøîmîIî‘ïSQî?îwî›ïSQî„ïSQ~î¦ïSQî¯ïSQî tî"wî#ñïSQî$ÙïSQ~î&LïSQî&¯ïSQvî ®ïQbîìî§î<wîyïQbîMïQbî)vî "ïQbî ÒïQbî#î'~î€ïO»wî°ïO»î„ïO»~î`ïO»îGïO»î‘ïNwîÚïNî­ïN~îŠïNîqïNî‘ïLlî?îî›îwîSî.î‘ïJÄîþî´îAîîøî‘ïIwîVïIî*ïIî~î‘ïGuîmîIî‘ïEÍîÝîjîÖî!î®îàîWî!”î#Mî&Öî))î‘ïD&î…wîïD&îúïD&~î»ïD&î‚ïD&îgîÞî#� î-ùî/Zî0¥î2î4†î5¯î‘ïB~îîî‘î�îíî Qî$µî'Äî,@î0Óî6 wî74ïB~î8ïB~î9ä~î‘ï@×îmîIî€ï?/î÷îî’î_îPî"ž wîSï=‡~îàï=‡wî,ï=‡îËï=‡îä~îdï;àîŒîBî!×î#{î%î'/î(zî*îdï:8î(î÷î �î"rî#ÿî%Ãî'î(›wîdï8‘î™~î€ï6éî÷wî‘ï5Aî~îdï5Aî+ï5Aîwî !ï5Aî Úï5A~î#Ìï5Aî$|ï5Aî%owî&üï5Aî'äï5A~î,¦ï5Aî-mï5Aî.Íî0î1¦wî£ï3šî×îd~î©ï3šîpï3šî Mwî$ï3šî%8ï3š~î(*ï3šî(Úï3šî*wî+œï3šî,„ï3š~î1Eï3šî2 ï3šî3mî4¸î6Ewî£ï1òî×î€ï0Kî0~î)ï0Kî�ï0Kî•îžî Lî"¬î%!î&Úî+vvî ®ï.\î¿îîYî îyîØ~î€ï,µwîÈï,µî�ï,µ~îï,µwîï,µî¾ï,µîêîé~î‘ï+ î?îwî›ï+ îfï+ ~îï+ îÊï+ wî¦ï+ î �ï+ ~î"ï+ î‘ï)fî?îwî›ï)fîTï)f~îfï)fîï)fîóî!î"{î%øwî'¦ï)fî(qï)f~î+$ï)fî+Õï)fwî,±ï)fî-|ï)f~î00ï)fî0àï)fwî1¼ï)fî2¥ï)f~î4ï)fî‘ï'¾wîòï'¾î\ï'¾~î;ï'¾îìï'¾î•î îóî _î‘ï&î|îŸîî 4wî! ï&î"kï&~î%ï&î%Ïï&wî&«ï&î'”ï&î‘ï$o~îeï$oîÈï$oîÆî”î!î®wî" ï$oî"ïï$o~î&ï$oî&�ï$owî'âï$oî(Êï$oî*Wî,Éî-yvî ®ï"�îìwîôï"�îÑï"�vî2ï"�î¶ï"�wî’ï"�îfï"�vî ï"�î‘ï"�wînï"�î ï"�vî®ï"�î2ï"�î wî"Æï"�î#/ï"�vî$Ñï"�î%Úï"�î(-î*úî ®ï “îæî*îïîMî!î œî%Ùî+…î/ î4<î8Nî;!î?ºîEeîG/zîÐïëîÐvîïëîÍïëîî¥î#î%eî'ëî)Rî/î23î4Ðî7ÚîšîA:îDTîF¨îÐï�îŽîOî¬îáî#³î&î(óî-ƒî0›î30î6¶î9î>äîA îCÊîG“îÐïõî¤îwî£ïõî\ïõvî!€ïõî"Gïõî%Ûî'”î)!î+äî.zî/¯î6>î;Îî=‡î?ƒîCéîÐïNîëî¥î‚îNî!lwî$•ïNî%`ïNî) vî1ïNî2ïNî4pî:9î<òîBþîG/îÐï§îyîîÐwîï§îÑï§vîï§îËï§î":î%áî'¹î*7 î0¶ î6þî8Ëî;Iî?îDîF‹îÐïÿyî ìï° î‹î9î—înzî ®ïaîGîî2îtî® vîÕïaî ¼ïaî#­î%×î)6î-àî1î2—î5´î8¥î; îAä î ìï ºîpî' îeîî!áî'$î)Ûî-!î.Kî3Úî6¨~î¿ï wîï îñï ~î©ï î ï wîzï îWï îz~î3ï wî&Žïûî+ ÿÈTVm$µCEDARLANGUAGEOVERVIEW20P[@W];FORiIN[0..100)DO...Q[@W[i]]...ENDLOOP;Toeliminatethefirst@byspecializingwewouldmakeacopyoftheprocedurePthatdealtwiththeWdirectlynotverysatisfactory.Toeliminatethefirst@bycopyingwewouldpassthearrayWinbyvalueandbackbyresultalsonotverysatisfactory.Itisbesttodealwiththefirst@byindirecting;justallocateWfromcollectablestorage,writingW:REFARRAY[0..100)OFZ=NEW[ARRAY[0..100)OFZ];P[W];Eliminatingthesecond@byspecializationisplausibleifQknowsitisalwaysdealingwitharrayelements:passareferencetoWalongwithanindex.Otherwise,decidingbetweencopyingandindirectingdependsuponthesizeofaZ.Ifitissmallcopyit,writing"W[i]_Q[W[i]]".Ifitisbigcreatereferencestoitandpassthose,writingW:REFARRAY[0..100)OFREFZ;P[W];FORiIN[0..100)DO...Q[W[i]]...ENDLOOP;Theformofvariantrecorddiscriminationthatdoesnotcopythevaluetoanewlocationcannotbeused.Supposeyouhaveavariant-recorddatastructurelikeT:TYPE=REFTR;TR:TYPE=RECORD[SELECTt:*FROMname,string=>[x:ROPE];link=>[i:INT,r:T];ENDCASE];andareaccustomedtoperformingdiscriminationslikee:T;WITHx:e^SELECTFROMname,string=>"Statementsusingx";link=>{S1[x.i];S2[@x]};ENDCASE;YoushoulddeclareasetofREFstoboundvarianttypeslikeName:TYPE=REFnameTR;String:TYPE=REFstringTR;Link:TYPE=REFlinkTR;andrewritethediscriminationtobeWITHeSELECTFROMx:Name=>"Statementsusingx";x:String=>"Statementsusingx";x:Link=>{S1[x.i];S2[x]};ENDCASE;ThetypeofxisnowaREFtype,notaTR,sovariousothertypesneedtobeadjustedandthe@inS2isnolongerneeded.If"Statementsusingx"isalargeblock,youwillprobablywanttointroduceaproceduretoavoidcopyingit.Variantrecordscannotbeoverwritten.Similiartechniquescanbeusedforsanitizingaprogramthatoverwritesvariantrecords.AssumingthedeclarationsofTandTRfromabove,supposeyouwantedtowritex:T_NEW[TR_[name["END"]];x^_[link[5,x]];Thespecialization/copyingtechniqueistosimplyupdatethethingthatpointsattherecord,writing"x_NEW[TR_[link[5,x]]]".However,ifyoudon'tknowalltheplacesthatpointattherecord,youmustintroduceanotherlevelofindirection,writingT:TYPE=REFREFTR;x:T_NEW[REFTR_NEW[TR_[rope["END"]]];CEDAR4.2vîØïgwîÕïgî �ïgvî#ïïgwî$×ïgvî+µïgwî,ÈïgsîG~ïg~îÐï_,wîÐï]…~î£ï]…wî‹ï]…îôï]…~îGï]…îªï]…wîï]…îþï]…~îDï]…î ï]…îüî×î&!î&üî'Øwî(´ï]…î)mï]…vî ìï[Ýî î)î•îyîkîs î"Òî%î)Aî-î.8î1–î3\î5Çî%î@‚îDîEèîG“î ìïXŽî ¬îzî×îé îtîÿî#$ î*¯î,<î-¾î0¸î2}î5�î8¾î;4î>"î@îB0 î ìïVçî �î�îrîÙ îžî"©~î¿ïU?wîïU?îñïU?îÍ~îYïU?î¼ïU?wî*ïU?îïU?î*~î MïU?wî"2ïU?î#ïU?~î)ÉïU?î*,ïU?wî.šïU?î/wïU?î0š~î1SïU?î1¶ïU?îÐïS˜vî ìïQð î�î:î î+îd î&î'½î-Ìî/jî1?î5Àî7Sî8üî=žîB¯îFî ìïPIîîÛîæîÄîTîî ¹î#µî%†î)‰ î0Dî5µî;î@îB© î ìïN¢îOî×î+îÊîwî•îLîÂî î lî#þî'Cî(æî-Œî1?î2Àî8¤î:î;dî<Äî?îC î ìïLúî šî ñî¨î¡î˜~î¿ïKSwîïKSîñïKSîÍ~îYïKSî¼ïKSwî*ïKSîïKSî*î!Ú~î"“ïKSîÐïI«wîÐïH~î£ïHwî‹ïHîôïH~îGïHîªïHwîïHîþïH~îDïHî ïHîüî×î$Àî%œî&wwî'SïHî( ïHzî ®ïE‰îˆîÜî—îDî~ î&]î)Fî,aî.Ûî2î4{î8î9Øî;#î=ÿîC;îG¿î ìïCávî UïCáîïCáîÚî‘îØî î"âî%çî+¤~î¿ïB:wî¤ïB:î]ïB:~îûïB:wîàïB:î´ïB:~î�ïB:îwïB:îÐï@’wî¾ï@’îwï@’~îï@’wîúï@’îÎï@’ ~î#Zï@’î#Éï@’wî%wï@’î&0ï@’~îáï>ëîùîÏîdwîuï>ëî Iï>ë~î"Öï>ëîáï=Cî®îCwîï=Cîqï=C~îÃï=CîGï=CîEwîáï;œ~î_ï;œîÂï;œvî ìï9ôî £î÷ îbî îBî(È~î¿ï8MîbwîÐï6¥~î]ï6¥îï6¥î wîåï6¥î…ï6¥îž~îáï4þîùîÏîd î%î(»îáï3Vî®îCîšwîáï1¯vî ìï0î ûîwî5î^î{wî4ï0îï0vîNï0î½ï0îüî$Xî(ôî,ˆ~î¿ï.`wîTï.`î ï.`~î«ï.`wî�ï.`îdï.`~î@ï.`îï.`îîÐï,¸wîbï,¸îï,¸~î¹ï,¸wîžï,¸îrï,¸~îNï,¸îÒï,¸î!$îÐï+wîšï+îSï+~îñï+wîÖï+îªï+~î†ï+îéï+îSvî ìï)iî £îKîª î¬îZwî¿ï'Â~îLï'Âwîvï'Âîï'Âî.~îÐï&î~îšî/ î Üî$†îÐï$sî~î–î, î Ùî$‚îÐï"Ëî~îÏîdî»wîÐï!#vî ìï|î ÂîÐîˆîºî$î&wîNï|î"ï|vîýï|îlï|îcî Öî!þî$Éî&Œî+Rî.ïî2‚î5Üî7‰î9xî>ðîA¦îDîEçîG“î ìïÕî zî ¢îîKîï î ¾î$Šî&‘î(î)kî,ôî1.î4î6Õî<Éî@HîBîHeî ìï-îoîîÝî zî ®ï²î¨îQî¿î� vî#áï²î$¨ï²î) î/ëî2xî4jî7§î9æ î@îA0îFÁî ìï î‹î.îaî Èî#. î*Ëî,Œî-þî0½î39î6§î;î@RîCîGàî ìïc~î¿ï¼îmîØwîeï¼îNï¼~îqï¼îXï¼îåîr îÐïîµîBîÝvî ìïmî Ìî�î üî"oî$%î(�î-7î/žî39î6î::î;Úî>AîBðîGªî ìïÆwî wïÆî _ïÆvî‚ïÆîiïÆîôîîî{î ®î" î$Áî(Sî,î-ýî0[î4qî7=î:ÙîÍîCrîF'î ìïîî"îhî! î!i~î¿ï wwî¤ï wî]ï w~îûï wwîàï wî´ï wî�î@~îùï wîï wîÐï Ïî~îêwîwï Ïî_ï Ïî2~îëï Ïîxï Ïwîï Ïîîï Ï~î"ï Ïî"øï Ïî$…î&wî&Žïûî+ ÿóTVm$ˆCEDARLANGUAGEOVERVIEW21x^_NEW[TR_[link[5,x]]];Unsafeprocedurescannotbepassedasargumentstosafeones.Thesymptomofaviolationofthisruleisgenerallyamessagecomplainingaboutanincorrecttypewhenthereisnoobvioustypemismatch.AllproceduretypesinaninterfaceprefixedbyCEDARareimplicitlyprefixedwithSAFE.ThesimplestthingtodoistoputSAFEinfrontofPROCintheargumentproceduredeclaration,andputTRUSTEDinfrontofitsbody.AswithallusesofTRUSTED,youshouldverifythatthesafetyinvariantsareactuallymaintained,anddocumentthereasonfortheTRUSTEDinacomment.CEDAR4.2vîØïgwîÕïgî �ïgvî#ïïgwî$×ïgvî+µïgwî,ÈïgsîG~ïg~îÐï_,îµwîBï_,î*ï_,~îMï_,î4ï_,îÂîOîêzî ®ï\šîW îîžîƒî"Ðî$žî+=î,÷î/Ïvî3Nï\šî46ï\šî6<îî?[îEîFíî ìïZóî µîîêîîN î"î%êî'Ëî-yî0zî4 î7›î8÷î:ïî@îCzî ìïYKvî GïYKî ïYKîÜî‚îCîFîþî%~wî'ŒïYKî(WïYKvî,ïYKî,¼ïYKî.| î4­î:.wî=[ïYKî=úïYKvî@@ïYKîA.ïYKîDî ìïW¤î ~î+î/î™îFwîÅïW¤îdïW¤vîïW¤îuïW¤î¾î/wî æïW¤î!ŽïW¤vî$qïW¤î$ÔïW¤î&î({î.£î5$ î<Œî?AwîAÁïW¤îBzïW¤vîG“ïW¤îGöïW¤î ìïUýî jî.îîôîî5î1î5wî ùïUýî!²ïUývî&cïUýî'JïUýî* î.“î2‰î5cî7Íî;Ä îBîDxî ìïTU îlî#î�îðî!Iî#‡wî%æïTUî&ŸïTUvî+ºïTUî,ïTUî-hî.‘wî&Žïûî+ ÿTVm$wCEDARLANGUAGEOVERVIEW22ForMoreInformation...CedarLanguageSyntaxThisisaone-pagereferencegrammardescribingthecompletesyntaxoftheCedarLanguage,inacompactvariationonBNFdevelopedbyButlerLampson.Keepithandyasyouwriteprograms.Itprovidesarelativelycompactsourceofinformationontheexactformofconstructsacceptedbythecompiler.Itwillalsoalertyoutomuchoftheavailablevarietyinthelanguagebutofcourse,noteverysyntacticallyvalidprogrammakessemanticsense.TheparsinggrammarusedbythecompilerissomewhatlargerandmorecomplexthantheReferenceGrammar.SomeofthisisfortechnicalreasonsassociatedwithLALR(1)parsing,andsomeofittoenablethecompilertomakecertainsemanticdistinctionswhileparsing.Thedifferencesshouldbeinvisiblewhendealingwithcorrectprograms,butmayaffecttheerrormessagesgivenforincorrectones.AnnotatedCedarExamplesThisdocumentcontainsfourcomplete,runnableCedarprogramschosentoillustratetheuseofmostofthemajorfeaturesofthelanguage,andtoprovideanintroductiontothestyleofprogrammingthatispreferredinCedar.YoushouldcertainlyinvesttimeinstudyingthembeforeattemptingtowriteCedarprograms.Ifyouareoneofthosewholearnsbestfromexamples,youmayfindthemvirtuallytheonlytutorialinformationyouneedtolearnthelanguage.TheseexampleshavebeenchosensothattheyarealsousefulprototypesofkindsofprogramsyoumaywanttowriteinCedar.IfyouarelikemostCedarprogrammers,youwillprobablyfinditeasiertostartfromsuchaprototype,andchangeittodowhatyouwant,thantoenterawholeprogram"fromscratch."StylizingCedarProgramsBecauseCedarprogrammerssofrequentlyreadeachother'scode,itisconsideredgoodcitizenshiptoadheretocertainstylisticconventions.StylizingCedarProgramsdiscussesthegenerallyagreedconventions.Youcansaveyourselfalotoftyping,andproducenicelyformattedcodeatthesametime,byusingTioga'sabbreviationexpansionmechanismtogenerateallthehigh-levelstructureofyourprogram(atleast,allthebitsthataren'tsimplycopied).ThefileCedar.abbreviationsliststheavailablemacrosandtheirexpansions;youcanaddyourownfavorites.CedarProgramStyleSheetThisisanannotatedprototypethatyouwillprobablywanttokeepclosetohand,becauseitcompactlyillustratesthemostimportantprinciplesfromthepreviousdocument.CedarLanguageReferenceManualEventually,thisisintendedtobeaprecisedefinitionofthecompletesyntaxandsemanticsoftheCedarLanguage.Itisstillincomplete.Theformaldefinitionofthelanguageisgivenintermsofakernellanguage,intowhichallCedarconstructscanbedesugaredtodeterminetheirprecisesemantics.TheReferenceManualcontainsboththedefinitionofthekernel,andanexplanationofthedesugarings.ItalsocontainsseveraltablesthatcollectimportantinformationabouttheprimitivetypesandtypeconstructorsofCedar.CEDAR4.2vîØïgwîÕïgî �ïgvî#ïïgwî$×ïgvî+µïgwî,ÈïgsîG~ïgxî ìï^õî îŸ î©î±îºyî ìï[¦î îî7vî ®ïXVîÒîIî~îpîxî$^ î+î-lî3_î7®î9rî;Üî?ÿîF¬îHeî ìïV¯î–î�î·î]î"%î$Qî(¯î/?î3&î4¬î9 î:èî=ÏîA}îHî ìïUî¤îø îî·î!/î# î*Åî,õî/~î30î6Áî8£ î?:îE îG/î ìïS`îóî^îþî¾îØîƒî&î!ñî#žî%ñî+ î0î1½î4 î=(î>ÖîCqîEÛî ìïQ¹ î¤î îšîÒî$ƒî ®ïO=îkî$îäîîçî!+î&Ìî(î.nî2>î4Ûî8Sî=½î@ÈîC î ìïM–îÄîÅî©îvî îvî#iî(r î/ î2Pî8ƒî=Ùî@¼îD{îF_îGàî ìïKîî�î.î'îîî!Ìî'» î/7î3*î8“î;ª îBäîGžî ìïJGîYîîËîÛîbî%Âî(7î+0î.ðî1Eî4«î:|î>%î@WîFyî ìïFøîŽî�vî ®ïC¨î³î î\îLî$xî*5î.9î48î8¶î:P î?áîB-îDŽîF2î ìïBî ®îîîLîîxî!Ÿî$`î&î+,î-& î5î6Àî9)î% îFÁî ìï@Yî …î»î–î3îoî î%àî*î-Wî/2î4ïî8¦î=" îD6îFî ìï>²îî•î+îõî\îîçî#šî&²î*Çî-¾î18î7¡î:kî=ƒî@„îD!î ìï= î Kîeî9 îÃîzî!×î#†î'î)bî ®ï:�î±î°îùîWî!ëî#±î&�î)’î+èî.¶î2Ð î9—î;Rî?î@ÃîFØî ìï8èî éî@îèî_îîpîëîœî!éî$Žî'äî+ö î4®î7^î:î?ÏîB·îDîGàî ìï7@î îxî´îé îŒîNî#î$bî&î(,î+”î.Uî2î5Fî6ÿî:’î;Çî?ÞîEwî ìï5™yî ìï2Jî›î�vî ®ï.úîøî î‡î S î&þî*!î-Zî1Þî5…î6ãî8W î?EîB¿ î ìï-Sî ñîÏîÕî³îé î%-î+)î/˜î6 î<*î>áîEî ìï+« î ®ï)0î°î0î(î]î{î�î.î#¾î&jî+·î/­î5÷î92î:¿î=î@„îCõîEåî ìï'‰î¾ îÂîNî$—î&[î+õî-úî0p î6æî<¹î>‡îAØîG}î ìï%áî yîyîéîšîxîiîéî%;î(#î*œî7 î9ÛîÀîB×îH9î ìïôîz î¤îî`î"Á î) î,sî.Óî4byî ìï¤î îî7î¡vî ®ïU îïîŸîîäî¡î!¡î"Ùî'… î-Þî/¦î2î8 î<^î?$îEhîG/î ìï­îî¦îî‰î* î ®ï2î‘î îcî(î“î$eî%Ýî)�î+Wî/-î0òzî2(ï2î2ïï2î6Zvî;•ï2î<}ï2î?aîC{îEwî ìïŠ îiîzîïŠî´ïŠvîTïŠîÃïŠîî#£î&úî+¦ î2Aî5)î;»î@àîFSî ìï ãî b îÃî“îî°î}î „ î(î)Ôî,J î4,î5ºî8�î>îB¾îFÁî ìï <î<î� î'î î"iî(Pî+äî.›î1« î9Xî;wî&Žïûî+ ÿ $TVm$\CEDARLANGUAGEOVERVIEW23CedarLanguageReferenceSummarySheetsThisisintendedtobetheessenceoftheentireCedarLanguagecarefullycondensedintotwopagesforreadyreference.Itcoversbothsyntaxandsemantics,withexamplesandnotes.Itisdefinitelynotforthosewithweakeyes,andshouldprobablynotevenbereaduntilyouhavestudiedtheReferenceManualproper.Butitshouldbeveryhelpfulincheckingdetailsthatyoumayhaveforgotten.Keepithandy.CedarCatalogSincesomuchCedarprogrammingisdone"atthecomponentlevel,"youneedtoknowwhatpackagesandtoolsareavailableandwhattheydo.Ingeneral,fulldocumentation(oratleastthebestavailableapproximationthereto)foreachcomponentisstoredon[Indigo]Documentation>,orisreferencedinthecomponent'sDFfile,storedon[Indigo]Top>.Theproblemisfindingoutwhichcomponentsyoushouldbeinterestedin.That'swheretheCedarCatalogcomesinhandy.ItcontainsasomewhatstructuredlistofallthecomponentsinCedarconsidered"interesting"bytheirmaintainers.Acomponentmaybeinterestingbecauseofwhatitprovides(yourprogrammaybecomeaclient),becauseofwhatitdoes(youpersonallymaybecomeauser),orbecauseofhowitdoesit(youmaystudyitorcopysomepartofitinyourprogram).Foreachentry,theCatalogindicateswhyitisconsideredinteresting,andhowtoacquiredocumentationandthecomponentitself.Italsoidentifiesthemaintainer,whoistheultimatesourceofadviceandhelp.Mesa5.0ManualTheMesaLanguageManual,Version5.0,PARCTechnicalReportCSL-79-3,isthemostrecentself-containedmanualontheMesaLanguage.Itfallssomewherebetweenatutorialandareferencemanual,andmanyusershavecomplainedthatitisn'tentirelysatisfactoryforeitherpurpose.ButifyouneedmoreinformationabouttheMesa-likepartsofCedar,itmaybeyourbestsource.Chapter4givesthedetailsofMesa'sbasiccontrolconstructs.Chapter5tellsallaboutprocedures.Chapter7goesintomoredetailthanyouprobablywantaboutthefinepointsofmodules,programs,andconfigurations.YoumaybebetteroffextrapolatingfromtheAnnotatedCedarExamples.Chapter8givessomeofthegorydetailsofexceptionsandexceptionhandling.Itiseasytogetintroubleunlessyouusetheminstraightforwardways.Chapter10providesaprettyreasonablediscussionofhowtomakeeffectiveuseofprocesses,monitors,conditionvariables,etc.WhotoseeIfyouhaven'tmanagedtofindinformationthatyouwantafteryouhavelookedinwhatyouconsidertobetheobviousplaces(orifyoudon'tunderstandwhatyouhavefound),don'thesitatetoask.AlmostanyoneinCSLisafountofwisdom,willingtobeaskedalmostanyquestiononalmostanysubject.(Ofcourse,theanswersaren'tequallyreliable,butyoucan'thaveeverything.)Ifthefirstpersonyouaskdoesn'tknowtheanswer,chancesaregoodthatyou'llgetapointertoeitherapersonordocumentthatwillhavetheanswer.Morespecificallyherearesomegoodpeopletoask:JohnMaxwellassistantoffirstresortforgeneralproblemswithCedarRussAtkinsonBugBaneCEDAR4.2vîØïgwîÕïgî �ïgvî#ïïgwî$×ïgvî+µïgwî,ÈïgsîG~ïgyî ìï_,î îî7î¡î ¿vî ®ï[ÝîÂî(îÞî†îqîËî!¤î#Wî%°î)–î-©î3íî9�î@LîCîEÄî ìïZ6î îà î+î™îÈîúî#4î%â î,eî/vî5iî8î<î=pî>Ò îDçîGRî ìïXŽî ¿îîÊîZîEîõî%úî(£î,î.Bî1�î5 î7öî;qî@yîC î ìïVçî îéî”îôîzîuî!�î&Vî( î-Óî2-î5î7Æî:Ôî>$ îDxîH9î ìïU@yî ìïQðî îvî ®ïN¡î—î�î™îå î#¬î%Lî(òî+oî.î5^î9áî<Ìî@\îB?îF2î ìïLúîÃî‹îíîQîî äî$Qî'rî)àî+Àî0üî3— î=î?\îAîD;îF«î ìïKSî¢ îÌîôî -î#Zî*}î+åî0î2îFdîH#î ìïI« î°î_î¾ îÂîMî"î&2î(9î ®ïG0î…î îtî<î±î!¿ î)kî,!î0�î2� î8Øî:Ýî?îCîEwî ìïE‰îáîùî‘îîcî±î Åî' î-‰î/±î1Tî3.î5x î=î>§îB© î ìïCá îîîI î î –î'¾î*Âî,² î ®ïAóîÏîˆîåî<îËî!î'î*î/(zî0RïAóî0íïAóvî3|ïAóî3öïAóî ®ï@îÏîˆîåî<îlîœ î%4î(7î-Nzî.wï@î/4ï@vî0Øï@î1Qï@î2-î ®ï>îÏîˆî�îãîîiîšî"�î&Sî'©î)mî,¿î0Rî36î4ïî6Eî7óî;.î ®ï;œîÇîfîÀî�î î&$î)‹î+Oî-) î4} î;üî?!îB“îD¯î ìï9ô îVîîuî¡î#Yî$Ôî'¤ î-›î/þ î7@î:Hî;·î>îC‚îGÖî ìï8Mî1îèyî ìï4þî ¶îóvî ®ï1¯zî¬ï1¯îï1¯îzîðî†î$£vî&\ï1¯î'_ï1¯î+êî2Pî7î=Ñî?cîAèîEkî ìï0 îãîøî+î¶î ‹î'Yî(üî,î3hî9î:Yî?YîB<îC‘î ìï.`î-îäî¯î,îr î#Üî&©î'ÿî*øî/÷ î7î9Qî==îBÖîEwîFØî ìï,¹î IîÜ îfîHî§î$ñî(Yî*î.‚î/Øî2Üî4Íî8î:ìî ®ï*Êîûî0î¢îîQî î#�î'î+µ î ®ï(Üîûî0îîîå î ®ï&îîèî îîÖîVî î#"î%Æî+…î.Îî2�î4êî7¤î;´î=ZîC$îÐï%Gîsî­î§î"—î$sî(Wî*u î2§î5ùî8Dî>ôîBøî ®ï#YîîGîÄîcî'î’î!Ãî&î'â î.§î1jî7«î=Éî?Lî@ÃîCÓîEŒîGáîÐï!±î™î¼îsîèî"qî$î-±î ®ïÃî;î`î.î—îÚ î&è î-ªî/¢î2æî4Ôî8Èî>ŒîAAîC9 îÐïîîî î# yî ìïÍî Hîvî ®ï~îfîTî_îrîXî!} î)>î,Cî/1î2Äî67î9%î<¢îA_îCDîFØî ìïÖîzî=îCî·îíîî!lî"âî%®î)W î0•î4î6Óî:.î?"îBËîGàî ìï/î ¥îdî%îÊîóîVîxî!%î"Öî(<î,¹î._î0Hî4î8sî; î@“îB‘îFîî ìïˆîâîcîîVîlî!Cî& î+Dî-»î0hî3±î6í î>xî?ðîBEîEî ìïàî Ûî}îsîjîî .î%}î(î+³î.¹î2Çî5Hî6ªî;«î=‘îA¶îCîGËî ìï9îYî'îÓîîyî lî$+ î+2î.Lî0 î43î7¥î