Hermes: A Tutorial and Reference Manual - Researcher - IBM
Hermes: A Tutorial and Reference Manual - Researcher - IBM
Hermes: A Tutorial and Reference Manual - Researcher - IBM
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
destination,source,<strong>and</strong>position.Someoperationstakeavariablenumber ofoper<strong>and</strong>s.Inthesecases,theoper<strong>and</strong>listwillappearasanellipsis. B.1.1DescriptionHeader Theoperationnameappearsrst,inbold-face,followedbyanoper<strong>and</strong>list. Ourexampledescribesthemergeatoperation,whichtakesthreeoper<strong>and</strong>s: Onthefarrightoftheheaderlineisalistoftheexceptionsthatcan AppendixB.<strong>Hermes</strong>Operations151<br />
beraisedbytheoperation.OurexampleshowsthatDepletion,RangeError,<strong>and</strong>DuplicateKeymayallberaisedbythemergeatoperation.The<br />
B.1.2TypeRules terminingthisarespeciedlaterintheoperationdescription.Inthiscase, DuplicateKeycanberaisedonlyifthedestinationisakeyedtable. Belowthedescriptionheaderarethetyperules,whichformthebasisfor parenthesessurroundingDuplicateKeyindicatethatinsomecasesitcan<br />
bothtypechecking(ensuringthatoper<strong>and</strong>sareofthecorrecttype),<strong>and</strong> bestaticallydetermined,basedonthetypesoftheoper<strong>and</strong>s,thatthe<br />
typeinferencing(deducingthetypeofundeclaredoper<strong>and</strong>sfromtheircontext).Thetyperulescomeintwoforms:classrules<strong>and</strong>inferencerules.<br />
classcontainsmanytypes.Thefollowingclassruleappearsinthemergeat Aclassrulespeciesthatanoper<strong>and</strong>mustbeofatypethatfallsina<br />
mergeatoperationcannotraiseDuplicateKey.Theexactconditionsde-<br />
description: speciedclass.Aclassrulecanneverbeusedtoinferatype,sinceatype<br />
ation.Anexampleinwhichnootheroper<strong>and</strong>appearscanbefoundinthe mergeatoperation:position typemayormaynotdependonthetypeofanotheroper<strong>and</strong>intheoper-<br />
Alistofthetypeclasses<strong>and</strong>theirmeaningsappearsinsectionB.2. Aninferenceruleconstrainsanoper<strong>and</strong>tobeofaparticulartype.That destination2orderedtable<br />
insertinstruction:element \assignmentrule."Thesecondrulerequiresthatelementbeofthetype predefined!integer.Thistypeofinferenceruleissometimescalledan Therstrulerequiresthatthepositionoper<strong>and</strong>beofthespecictype, Foranexampleinvolvingtwooper<strong>and</strong>s,wehavethefollowingfromthe elementtypeof(table) predefined!integer<br />
function"tothetypeofthetableoper<strong>and</strong>.Allinferencefunctions<strong>and</strong> theirmeaningsarelistedinsectionB.3. thatisuniquelydeterminedbyapplyingtheelementtypeof\inference