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

Create successful ePaper yourself

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

6Introduction Thereferencemanualpresentstherulesof<strong>Hermes</strong>.Mostoftherulesare programs,compilation,BNF,etc. denedinmachine-readabletables.Weexplainhowtoreadthetables. Weexplaintheotherrulesinformallybutrigorously.Themanualcontains minglanguage.Therefore,wewillnotexplainbasicconceptssuchasstored examplesofhowtoapplytherules,buttheseexamplesarenotnecessarily typicalorpreferredusesof<strong>Hermes</strong>. torial.Wealsoassumethatyouhaveexperiencewithsomeotherprogram-<br />

Herearethestagesofwriting<strong>and</strong>executinga<strong>Hermes</strong>program. Weassumethatyouhavealreadyread<strong>and</strong>understoodthe<strong>Hermes</strong>tu-<br />

Youwritethecodeusingyourfavoriteeditor/programgenerator, Therststageofthecompilerconvertsyoursourceleintoa<strong>Hermes</strong> producingasourcele.<br />

Youstorethecheckedprogramintoaprogramlibrary. Youretrievethecheckedprogram,instantiateitasaprocess,<strong>and</strong> The<strong>Hermes</strong>compilerchecksthe<strong>Hermes</strong>program,producingachecked gramwillincludeitstranslationtomachinecode.Likeallinternal programvalue.Theinternalrepresentationofachecked<strong>Hermes</strong>pro-<br />

representations,thiswillbeinvisibletotheprogrammer.<br />

program.Thisbypassesthersttwostepsmentionedabove. producethesourcele.Theremainingstepsarebrokendownasfollows: Youmayalsogeneratea<strong>Hermes</strong>programvaluedirectlywithina<strong>Hermes</strong> Inthismanual,weignoretherststepbecausewedonotcarehowyou Lexicalanalysis:Thecharactersintheprogramaredividedintotokens.Space<strong>and</strong>commenttokensarethrownaway,<strong>and</strong>theother<br />

writteninaformalgrammar.Lexicalanalysisisexplainedinchapter 7. tureoftheprogram.Thesyntaxrulesarewritteninaformalgrammar inAppendixA.<br />

executeit.<br />

Syntaxanalysis:Thestreamoftokensisparsed,revealingthestruc-<br />

tokensarepassedasinputtosyntaxanalysis.Thelexicalrulesare

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

Saved successfully!

Ooh no, something went wrong!