《递归下降分析 (54).ppt》由会员分享,可在线阅读,更多相关《递归下降分析 (54).ppt(7页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、Compiler ConstrucionS1Generation of Target CodeInvolves two standard techniques1.Macro expansionReplaces each intermediate code instruction with an equivalent sequence of target code instructions.2.Static simulationStraight-line simulation of the effects of the intermediate code and generating targe
2、t code to match these effects.Compiler ConstrucionS2Exampleexp id=exp|aexpaexp aexp+factor|factorfactor (exp)|num|idlda xlod xldc 3adistnldc 4adit1=x+3x=t1t2=t1+4(x=x+3)+4Compiler ConstrucionS3Static Simulationlda xlod xldc 3adistnldc 4adiaddress of xx3top of stackt1=x+3address of xt1top of stackCom
3、piler ConstrucionS4Static Simulationlda xlod xldc 3adistnldc 4adix=t1address of xt1top of stackt1top of stackCompiler ConstrucionS5Static Simulationlda xlod xldc 3adistnldc 4adit2=t1+44t1top of stackt2top of stackt1=x+3x=t1t2=t1+4Compiler ConstrucionS6Exampleexp id=exp|aexpaexp aexp+factor|factorfactor (exp)|num|idlda xlod xldc 3adistnldc 4adit1=x+3x=t1t2=t1+4(x=x+3)+4Compiler ConstrucionS7Macro Expansiont1=x+3x=t1t2=t1+4lda t1lod xldc 3adistolda xlod t1stolda t2lod t1ldc 4adistolda t1lod xldc 3adistolda xlod t1stolda t2lod t1ldc 4adistot1=x+3x=t1t2=t1+4