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.

7Lexical<strong>and</strong>SyntacticRules lectionsofcharactersthatconstitutetheelementarysyntacticunits.The Lexicalanalysisseparatesthesourceprogramintotokens.Tokensarecol-<br />

dierentkindsoftokenin<strong>Hermes</strong>are:spaces,comments,integerliterals,<br />

asetofstatementlines,precedeeachlinewithadoubledash. thanalinetoseewhatisacomment<strong>and</strong>whatisnot.To\commentout" multiplelines.Becauseofthisrule,youneednotlookatacontextbigger realliterals,namedliterals,stringliterals,punctuation,<strong>and</strong>words. with\/".Commentsdelimitedwith\/"<strong>and</strong>\/"maynotextendacross umentation,buttothecomputertheyareequivalenttospaces.Thereare totheendoftheline.Commentswithinalinebeginwith\/"<strong>and</strong>end twocommentingstyles.Adoubledash\--"startsacommentthatruns Aliteraltokendenesacompile-timeknownvalue. Spacesareusedtoseparatetokens.Commentsareusedforhum<strong>and</strong>oc-<br />

Arealliteralconsistsofanunsignedintegerpart,adecimalpoint,a Anintegerliteraltokenisadecimalrepresentationofanunsigned toanintegerliteral. integer.Someexamplesofintegerliteralsare0,112358,<strong>and</strong>000. fractionpart,an\e"(upperorlowercase),<strong>and</strong>anoptionallysigned Noticethat-2isnotatoken.Itisparsedasaunaryoperatorapplied<br />

Anamedliteralisrepresentedbyanonemptystringofcharacters integerexponent.Theintegerpartmusthaveatleastonedigit,but raisedtothepowerof".Someexamplesare15.,0.,1.12358, thefractionpartcanbeempty.Thesymbol\e"means\timesten enclosedintwosinglequotessuchthat,insidethedelimitingquotes, 0.314159e+02<strong>and</strong>314.159e-02.<br />

Astringliteralisrepresentedbya(possiblyempty)stringofcharactersenclosedintwodoublequotessuchthat,insidethedelimiting<br />

ofconsecutivesinglequotesisregardedasonesinglequote.Thecase ofthecharactersissignicantinnamedliterals.Someexamplesof thestringofcharactersinsidethedelimitingquoteswhereeverypair singlequotesalwaysoccurinpairs.Thevalueofanamedliteralis namedliteralsare'true'<strong>and</strong>'Isn''t'.Anamedliteralcannot extendpastasingleline. everypairofconsecutivedoublequotesisregardedasonedouble literalisthestringofcharactersinsidethedelimitingquoteswhere quotes,doublequotesalwaysoccurinpairs.Thevalueofastring

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

Saved successfully!

Ooh no, something went wrong!