英文文献及翻译:计算机程序

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

ComputerLanguageandProgrammingI.IntroductionProgramminglanguages,incomputerscience,aretheartificiallanguagesusedtowriteasequenceofinstructions(acomputerprogram)thatcanberunbyacomputer.Similartonaturallanguages,suchasEnglish,programminglanguageshaveavocabulary,grammar,andsyntax.However,naturallanguagesarenotsuitedforprogrammingcomputersbecausetheyareambiguous,meaningthattheirvocabularyandgrammaticalstructuremaybeinterpretedinmultipleways.Thelanguagesusedtoprogramcomputersmusthavesimplelogicalstructures,andtherulesfortheirgrammar,spelling,andpunctuationmustbeprecise.Programminglanguagesvarygreatlyintheirsophisticationandintheirdegreeofversatility.Someprogramminglanguagesarewrittentoaddressaparticularkindofcomputingproblemorforuseonaparticularmodelofcomputersystem.Forinstance,programminglanguagessuchasFORTRANandCOBOLwerewrittentosolvecertaingeneraltypesofprogrammingproblems—FORTRANforscientificapplications,andCOBOLforbusinessapplications.Althoughtheselanguagesweredesignedtoaddressspecificcategoriesofcomputerproblems,theyarehighlyportable,meaningthattheymaybeusedtoprogrammanytypesofcomputers.Otherlanguages,suchasmachinelanguages,aredesignedtobeusedbyonespecificmodelofcomputersystem,orevenbyonespecificcomputerincertainresearchapplications.Themostcommonlyusedprogramminglanguagesarehighlyportableandcanbeusedtoeffectivelysolvediversetypesofcomputingproblems.LanguageslikeC,PASCALandBASICfallintothiscategory.II.LanguageTypesProgramminglanguagescanbeclassifiedaseitherlow-levellanguagesorhigh-levellanguages.Low-levelprogramminglanguages,ormachinelanguages,arethemostbasictypeofprogramminglanguagesandcanbeunderstooddirectlybyacomputer.Machinelanguagesdifferdependingonthemanufacturerandmodelofcomputer.High-levellanguagesareprogramminglanguagesthatmustfirstbetranslatedintoamachinelanguagebeforetheycanbeunderstoodandprocessedbyacomputer.Examplesofhigh-levellanguagesareC,C++,PASCAL,andFORTRAN.Assemblylanguagesareintermediatelanguagesthatareveryclosetomachinelanguagesanddonothavetheleveloflinguisticsophisticationexhibitedbyotherhigh-levellanguages,butmuststillbetranslatedintomachinelanguage.1.MachineLanguagesInmachinelanguages,instructionsarewrittenassequencesof1sand0s,calledbits,thatacomputercanunderstanddirectly.Aninstructioninmachinelanguagegenerallytellsthecomputerfourthings:(1)wheretofindoneortwonumbersorsimplepiecesofdatainthemaincomputermemory(RandomAccessMemory,orRAM),(2)asimpleoperationtoperform,suchasaddingthetwonumberstogether,(3)whereinthemainmemorytoputtheresultofthissimpleoperation,and(4)wheretofindthenextinstructiontoperform.Whileallexecutableprogramsareeventuallyreadbythecomputerinmachinelanguage,theyarenotallprogrammedinmachinelanguage.Itisextremelydifficulttoprogramdirectlyinmachinelanguagebecausetheinstructionsaresequencesof1sand0s.Atypicalinstructioninamachinelanguagemightread1001011001011andmeanaddthecontentsofstorageregisterAtothecontentsofstorageregisterB.2.High-LevelLanguagesHigh-levellanguagesarerelativelysophisticatedsetsofstatementsutilizingwordsandsyntaxfromhumanlanguage.Theyaremoresimilartonormalhumanlanguagesthanassemblyormachinelanguagesandarethereforeeasiertouseforwritingcomplicatedprograms.Theseprogramminglanguagesallowlargerandmorecomplicatedprogramstobedevelopedfaster.However,high-levellanguagesmustbetranslatedintomachinelanguagebyanotherprogramcalledacompilerbeforeacomputercanunderstandthem.Forthisreason,programswritteninahigh-levellanguagemaytakelongertoexecuteanduseupmorememorythanprogramswritteninanassemblylanguage.3.AssemblyLanguagesComputerprogrammersuseassemblylanguagestomakemachine-languageprogramseasiertowrite.Inanassemblylanguage,eachstatementcorrespondsroughlytoonemachinelanguageinstruction.Anassemblylanguagestatementiscomposedwiththeaidofeasytoremembercommands.ThecommandtoaddthecontentsofthestorageregisterAtothecontentsofstorageregisterBmightbewrittenADDB,Ainatypicalassemblylanguagestatement.Assemblylanguagessharecertainfeatureswithmachinelanguages.Forinstance,itispossibletomanipulatespecificbitsinbothassemblyandmachinelanguages.Programmersuseassemblylanguageswhenitisimportanttominimizethetimeittakestorunaprogram,becausethetranslationfromassemblylanguagetomachinelanguageisrelativelysimple.Assemblylanguagesarealsousedwhensomepartofthecomputerhastobecontrolleddirectly,suchasindividualdotsonamonitorortheflowofindividualcharacterstoaprinter.III.ClassificationofHigh-LevelLanguagesHigh-levellanguagesarecommonlyclassifiedasprocedure-oriented,functional,object-oriented,orlogiclanguages.Themostcommonhigh-levellanguagestodayareprocedure-orientedlanguages.Intheselanguages,oneormorerelatedblocksofstatementsthatperformsomecompletefunctionaregroupedtogetherintoaprogrammodule,orprocedure,andgivenanamesuchas“procedureA.”Ifthesamesequenceofoperationsisneededelsewhereintheprogram,asimplestatementcanbeusedtoreferbacktotheprocedure.Inessence,aprocedureisjustamini-program.Alargeprogramcanbeconstructedbygroupingtogetherproceduresthatperformdifferenttasks.Procedurallanguagesallowprogramstobeshorterande

1 / 9
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功