欢迎来到得力文库 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
得力文库 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    (1.1.1)--1Overview.pdf

    • 资源ID:57971668       资源大小:484.49KB        全文页数:23页
    • 资源格式: PDF        下载积分:8金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要8金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    (1.1.1)--1Overview.pdf

    Compilers TechniquesIntroductionThe position of compilation principle course in computer science and technology:ProgramminglanguageDiscreteMathematicsDatastructureCompilationprinciplesOperatingsystemInformationsystemsE-commerceSystemsoftwareApplicationsoftwareSoftwareengineeringIntroductionGeneral principles and basic implementation methods of compiler construction are introducedTheoretical knowledge:formal language and automata theory,Syntax-directed definition and attribute grammar,typology and type system,principle of program analysis,etcEmphasis on formal description technologyEmphasis on macro understanding of compilation principles and techniques,no distraction from branch algorithms,no bias towards a source language or target machineCourse ContentSignificance of LearningHave a deep understanding of the implementation and design of programming language,understand the theory related to programming language,which plays a foundation role in the macro grasp of programming languageFrom the view of software engineering,compiler is a good example.The concepts and techniques introduced can be applied to general software designApplication and development of compiler technology.Advanced language design,computer architecture optimization(parallel,memory stratification),new computer architecture design,program translation,Tools for improving software development efficiency,highly trusted softwareCourse ContentIntroductionThe compiler can logically be divided into several stagesEach stage transforms the source program from one representation to anotherThis chapter introduces the topic of compiling by describing the various stages of the compilerLexical analyzerSyntax analyzerSemantic analyzerSource programIntermediate-code generatorMachine-independent code optimizerCode generatorMachine-dependent code optimizerTarget-machine codeSymbol tableCompilerOverviewCompilerOverviewSymbol tablepositioninitialrate.123 token flowscharacter streamlexical analysis:source program lexical token stringLexical analyzer id,1 =id,2 +id,3 60 position=initial+rate 60Syntax features of expressionsAny identifier is an expressionAny number is an expressionIf e1 and e2 are all expressions,then e1+e2 e1*e2(e1)are all expressionsExpressionExpressionExpressionIdentifierExpressionExpression(initial)Identifier(rate)Digit(60)*+Parse tree of initial+rate*60 Syntax analysis:lexical token flow syntax phrasesCompilerOverview Syntax tree token flowsSymbol tablepositioninitialrate.123CompilerOverviewSyntax analyzerid,1=id,2+id,3 60=+60id,1id,2id,3Symbol table position initial rate.123 Syntax tree Syntax tree Semantic analysis:checking the semantic correctness of a program,such as type checking CompilerOverviewSemantic analyzer=+60id,1id,2id,3=+inttofloatid,1id,2id,360 grammar treeSymbol tablepositioninitialrate.123 Three-address intermediate codeCompilerOverviewIntermediate-code generatort1=inttofloat(60)t2=id3 t1t3=id2+t2id1=t3=+inttofloatid,1id,2id,360Three-address intermediate codeSymbol tablepositioninitialrate.123Three-address intermediate codeCompilerOverviewCode optimizert1=inttofloat(60)t2=id3 t1t3=id2+t2id1=t3t1=id3*60.0id1=id2+t1 Assembly codeThree-address intermediate codeSymbol tablepositioninitialrate.123CompilerOverviewCode generatorMOVF id3,R2MULF#60.0,R2MOVF id2,R1ADDF R2,R1MOVF R1,id1t1=id3*60.0id1=id2+t1Lexical analyzerSyntax analyzerSemantic analyzerSource programIntermediate-code generatorMachine-independent code optimizerCode generatorMachine-dependent code optimizerTarget-machine codeSymbol tableCompilerOverviewDifference between an interpreter and a compilerInstead of generating the target code,the interpreter directly performs operations specified by the source program.The interpreter also needs lexical,syntax,and semantic analysis of the source program,and intermediate-code generationBASIC era interpreterFunction:It translates the source program of a high-level language into an intermediate language program and then interprets and executes it.At that time,the functions of compiling and interpreting were combined in a program called the interpreterJava era interpreterThe above two functions of the interpreter are divided into two programsThe former is called a compiler,which translates the source program into an intermediate language prmgram called bytecodeThe latter is called the interpreter,which interprets bytecode programsCompilerOverviewLexical analyzerSyntax analyzerSemantic analyzerSource programIntermediate-code generatorMachine-independent code optimizerCode generatorMachine-dependent code optimizerTarget-machine codeCompilerOverviewPhase groupingFront endBack endFront end:dependent on the source language,independent of the target machine.Back end:dependent on the target machine,independent of the source language.Front end andBack endThe compilation process is divided into front-end and back-end.Front end:dependent on source only,independent of target machine(generating intermediate code)Take the front end of a compiler and rewrite its back end to produce the compiler of same source language on another machineDifferent front ends use the same back end to get several compilers on one machine(using the same intermediate language)Backend:Dependent on the target machine,independent of the source program,only related to the intermediate language(Generate target code from intermediate code)Benefits:Increased efficiency in developing compilersIntroductionSource program Target Machine 1Target Machine 2Target Machine 3Target machine nCompilerCompiler that do not distinguish between front end and back end Source program Target Machine 1Target Machine 2Target Machine 3Compilers front endCompilers back end Compilers that distinguish between front end and back end Target machine nIntroductionLexical analyzerSyntax analyzerSemantic analyzerSource programIntermediate-code generatorMachine-independent code optimizerCode generatorMachine-dependent code optimizerTarget-machine codePhase grouping PassA pass scan is commonly used in several stages of compilation.A scan includes reading an input file and writing an output file.IntroductionPass:One pass:refers to the whole process that the compiler scans the source program or the equivalent of the source program(intermediate program)from the beginning to the end at the time of compilation and converts it into another adjacent equivalentSingle pass scan and multi pass scan:each scan can complete one or more of the above stages.The input of each pass is the output of the previous one,the input of the first pass is the text of the source program,and output of the last pass is object code.Comparison of single and multiple pass:More passes:compiler structure is clear,but time efficiency is not highFewer passes:fast compilation,but high memory requirements for machinesNumber of passes determination:the main factor is the source program and machine(target machine)characteristics.IntroductionTools for improving the efficiency of software developmentType checking:Type checking is a mature and effective technique to capture inconsistencies in programs.Boundary check:Data flow analysis technology can be used to locate buffer overflow.Memory management:Automatic memory management deletion,memory leakage and other memory management errors.Program analysis derived from code optimization techniques in compilers has been improving software development efficiency.Application of Compiler TechnologySyntax-directed structured editor Program formatting toolsSoftware testing toolsProgram understanding toolsTranslation tools for high-level languagesetc.Application of Compiler TechnologyCompilers TechniquesIntroduction

    注意事项

    本文((1.1.1)--1Overview.pdf)为本站会员(刘静)主动上传,得力文库 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知得力文库 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于得利文库 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

    © 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

    黑龙江省互联网违法和不良信息举报
    举报电话:0468-3380021 邮箱:hgswwxb@163.com  

    收起
    展开