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.

isconcerned.Allthe\noisewords",likeof,from<strong>and</strong>into,whichmakethe <strong>Hermes</strong>programvalue.Thisisamuchsimplerformasfarasthecomputer Afteramodulehasbeentokenized,parsed,<strong>and</strong>resolved,itisstoredasa 9TypeChecking<strong>and</strong>Inference programeasierforpeopletoreadbutlesssyntacticallyregular,aregone. Statementswithembeddedexpressionsareexp<strong>and</strong>edouttosequencesof statements.Names,likeX,whoseresolutionmaybecontext-sensitive,have beenremoved.Intheirplaceareuniqueidentiers. clauseisaseriesofstatements,<strong>and</strong>eachstatementisanoperator,alistof oper<strong>and</strong>s(variablenames),<strong>and</strong>a\qualier",whichiseverythingelse.By ofdeclarations,organizedinto\scopes";(3)acollectionofclauses.Each constraintdenitions,organizedintodenitionsmodules;(2)acollection declared. thistime,allbasevariablenamesexceptexpressiontemporarieshavebeen The<strong>Hermes</strong>programvalueis:(1)acollectionoftypedenitions<strong>and</strong><br />

inferencerulesareusedforbothinference<strong>and</strong>checking.Theclassrulesare rules.Therearetwofamiliesofrules:inferencerules,<strong>and</strong>classrules.The typesoftheoper<strong>and</strong>s. theexpressiontemporariessothateverybasevariablewillhaveaknown type;(2)typechecking:tocheckthattheoperationsarelegal,giventhe anextrasetofcheckswhichapplyaftertypeinferenceiscomplete. Bothtypeinference<strong>and</strong>typecheckingaredrivenfromasingletableof Thejobofthenextphaseis:(1)typeinference:tosupplydeclarationsfor<br />

thetypeoftheoper<strong>and</strong>ontheleft. theleft.Thesecondkindofruleisredwhenthetypeoftheoper<strong>and</strong>on therightbecomesknown.Theruleprovidesafunctionwhichdetermines inferencerule:oper<strong>and</strong> Therstkindofruleunconditionallyassignsatypetotheoper<strong>and</strong>on Therulesappearintheappendix.Thesyntaxofaninferenceruleis:<br />

insertat(table,element,position)absent Thetyperulesinthetableentryforthisoperationlooklikethis:<br />

rulename()<br />

table2orderedtable rulename(oper<strong>and</strong>)<br />

tointherulesastable,element,<strong>and</strong>position.Thereisnoqualier.The thattheoperationinsertathasthreeoper<strong>and</strong>s,whichwillbereferred Forexample,let'slookattheoperationinsertat.Theheaderlinestates<br />

element elementtypeof(table) predefinedinteger()

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

Saved successfully!

Ooh no, something went wrong!