28.01.2015 Views

Hermes: A Tutorial and Reference Manual - Researcher - IBM

Hermes: A Tutorial and Reference Manual - Researcher - IBM

Hermes: A Tutorial and Reference Manual - Researcher - IBM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

droppedattributesafternormalcompletionoperation. Threetypesofstatementsareh<strong>and</strong>ledspecially: Thecompoundstatementshavemorecomplexpostconditionrules Thecallstatementisdierentbecausethenormal<strong>and</strong>exception postconditionscomefromtheinterfacedenition. 10.TypestateChecking91<br />

Similarly,everystatementcontainingaselectorisanalyzedasifit owgraph. manualwedescribethetypestatepostconditionresultingfromthis weretwostatements:aselectorfollowedbyaprimitivestatement. Therulesinthetabledenetheprecondition<strong>and</strong>postconditionrules booleanteststatement<strong>and</strong>theembeddedclauses.Inthereference anifstatementbehavesasifitwerecomposedofamoreprimitive becausetheyareequivalenttominiatureowgraphs.Forinstance,<br />

typestatepropagatedfromthestatementperformingtheforwardbranch. withinblock,if<strong>and</strong>selectstatementstotheendofthestatementare betweentheprevioustypestateassociatedwiththedestination<strong>and</strong>the forwardbranches.Whenaforwardbranchisencountered,themeetistaken Exceptions,exitstatements,<strong>and</strong>thebranchesfromtheendofclauses Eachloopconstruct(while,for)performsasinglebackwardbranchfrom selectors. fortheprimitivestatement;theserulesareappliedaftertherulesfor<br />

ofthelooparethenre-analyzed. typestatepreviouslyassociatedwiththetopoftheloop.Thestatements theendoftheloopislowerthanorincomparabletothetypestateatthe beginning,themeetistakenbetweenthetwotypestates.Thislowersthe isdoneexcepttointroduceanynecessarycoercion.Ifthetypestateat theendofthelooptothebeginning.Ifthetypestateattheendoftheloop isstrictlygreaterthanorequaltothetypestateatthebeginning,nothing<br />

Thepossibletypestateerrormessagesare: tate<strong>and</strong>noloopsneedtobere-analyzed.Inpractice,noloopwillneedto beanalyzedmorethantwice. 10.9TypestateErrors Analysiscontinuesuntilallprogrampointshavebeenassignedatypes-<br />

Deadcode:Astatementcannotbereached.Rememberthattypestatecheckingignoresthevaluesofvariables,sothatevenastatemenception.Thiserrorariseswhenyouwriteastatementafteranexit<br />

beginningif'false'then...doesnotgenerateadeadcodeex-<br />

statementorafteracompoundstatementallofwhosealternatives

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

Saved successfully!

Ooh no, something went wrong!