⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compiler theory and design.htm

📁 英文版编译器设计:里面详细介绍啦C编译器的设计
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0043)http://topaz.cs.byu.edu/text/html/Textbook/ -->
<HTML><HEAD><TITLE>Compiler Theory and Design</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1458" name=GENERATOR></HEAD>
<BODY>
<CENTER>
<H2><FONT face=Arial>Table of Contents</FONT> </H2></CENTER><B><FONT 
face=Arial>Preface </FONT>
<MENU><FONT face=Arial>Audience<BR>Organization of this 
  Book<BR>Acknowledgements<BR></FONT></MENU>
<P>
<H2><FONT face=Arial>Part I: Introduction to Compiler Design</FONT> </H2>
<MENU><FONT face=Arial>1 Introduction </FONT>
  <MENU><FONT face=Arial>1.1 The Precise Target Language<BR>1.2 The Precise 
    Target Architecture<BR>1.3 What Are the Advantages of Using This 
    Book?<BR></FONT></MENU>
  <P><FONT face=Arial>2 </FONT><A 
  href="http://topaz.cs.byu.edu/text/html/Textbook/Chapter2/index.html"><FONT 
  face=Arial>The Components of a Compiler</FONT> </A><BR>
  <MENU><FONT face=Arial>2.1 The Components of a Compiler<BR></FONT>
    <MENU><FONT face=Arial>2.1.1 Scanner (Lexical Analzer)<BR>2.1.2 The 
      Parser<BR>2.1.3 Symbol Tables<BR>2.1.4 Error Messages<BR>2.1.5 Code 
      Optimization<BR>2.1.6 Code Generation<BR>2.1.7 Peephole 
      Optimization<BR></FONT></MENU><FONT face=Arial>2.2 The Number of Compiler 
    Passes<BR>2.3 The Target Architecture<BR></FONT></MENU>
  <P></P></MENU>
<H2><FONT face=Arial>Part II: The Analysis Phase of Compilation</FONT> </H2>
<MENU><FONT face=Arial>3 </FONT><A 
  href="http://topaz.cs.byu.edu/text/html/Textbook/Chapter3/index.html"><FONT 
  face=Arial>Lexical Analysis</FONT> </A><BR>
  <MENU><FONT face=Arial>3.1 Overview of a scanner<BR></FONT>
    <MENU><FONT face=Arial>3.1.1 Regular Grammars<BR>3.1.2 Finite State 
      Automata<BR>3.1.3 Combining FSAs<BR></FONT></MENU><FONT face=Arial>3.2 SAL 
    Scanner Overview<BR></FONT>
    <MENU><FONT face=Arial>3.2.1 The SAL Input Interface<BR>3.2.2 Token 
      Representation<BR></FONT></MENU><FONT face=Arial>3.3 Scanning SAL 
    Tokens<BR></FONT>
    <MENU><FONT face=Arial>3.3.1 Symbols and Delimeters<BR>3.3.2 
      Constants<BR>3.3.3 Identifiers and Keywords<BR>3.3.4 Whitespace<BR>3.3.5 
      Comments<BR></FONT></MENU><FONT face=Arial>3.4 Writing a SAL 
    Scanner<BR></FONT>
    <MENU><FONT face=Arial>3.4.1 Lookahead buffer<BR>3.4.2 Internal helper 
      procedures<BR>3.4.3 General algorithm<BR>3.4.4 Scanner Error Messages and 
      Procedures<BR>3.4.5 Using The Scanner<BR></FONT></MENU></MENU>
  <P><FONT face=Arial>4 </FONT><A 
  href="http://topaz.cs.byu.edu/text/html/Textbook/Chapter4/index.html"><FONT 
  face=Arial>The Parser</FONT> </A><BR>
  <MENU><FONT face=Arial>4.1 Productions and Syntax Diagrams<BR>4.2 Top-down 
    Recursive Descent Parsing<BR>4.3 Using Syntax Diagrams in Recursive Descent 
    Parsing<BR>4.4 Coding a Recursive Descent Parser<BR></FONT>
    <MENU><FONT face=Arial>4.4.1 Using the Set, FIRST<BR>4.4.2 A Simple 
      Parser<BR></FONT></MENU><FONT face=Arial>4.5 Error-Checking<BR></FONT>
    <MENU><FONT face=Arial>4.5.1 Tools to Manage FIRST and FOLLOW<BR>4.5.2 
      Entry and Exit Synchronization<BR>4.5.3 Maintaining CURRENT<BR>4.5.4 A 
      Simple Parser With Error Checking<BR></FONT></MENU><FONT face=Arial>4.6 A 
    SAL Parser<BR>4.7 Conclusion<BR></FONT></MENU>
  <P><FONT face=Arial>5 </FONT><!--<A href="./Chapter5/index.html"><FONT face=Arial>Symbol Tables</FONT> </A><br>--><A 
  href="http://topaz.cs.byu.edu/cs431/html/text/ch6.pdf"><FONT face=Arial>Symbol 
  Tables</FONT> </A><BR>
  <MENU><I><FONT face=Arial>Fields<BR>Identifiers<BR></FONT>
    <MENU><FONT 
      face=Arial>Types<BR>Constants<BR>Variables<BR>Functions<BR>Blocks<BR></FONT>
      <MENU><FONT 
      face=Arial>Records<BR>Functions<BR>Modules<BR></FONT></MENU><FONT 
      face=Arial>Arrays<BR></FONT></MENU><FONT face=Arial>Accessing the 
    Table<BR></FONT><A 
    href="http://topaz.cs.byu.edu/text/html/Textbook/Chapter5/SymbolExamples.txt"><FONT 
    face=Arial>Examples</FONT> </A><BR></I></MENU>
  <P></P></MENU>
<H2><FONT face=Arial>Part III: The Synthesis Phase of Compilation</FONT> </H2>
<MENU><FONT face=Arial>6 </FONT><A 
  href="http://topaz.cs.byu.edu/text/html/Textbook/Chapter6/index.html"><FONT 
  face=Arial>Beginning Code Generation</FONT> </A><BR>
  <MENU><FONT face=Arial><A 
    href="http://topaz.cs.byu.edu/cs431/html/Text/Chapter10.pdf">6.1 Assignment 
    and Expressions </A><IMG src="Compiler Theory and Design.files/updated.gif" 
    NOSAVE> </FONT>
    <MENU><FONT face=Arial>6.1.1 Setting Up and Calling Rule 
      IdentExpression<BR>6.1.2 Handling Procedure Calls<BR>6.1.3 Evaluating the 
      Expression and Storing the Result<BR></FONT></MENU><FONT face=Arial>6.2 
    Evaluating an Expression<BR></FONT>
    <MENU><FONT face=Arial>6.2.1 Rule Expression<BR>6.2.2 Rule 
      LandExpression<BR>6.2.3 Rule CmpExpression<BR>6.2.5 Rule 
      BandExpression<BR>6.2.6 Rule BitwExpression<BR>6.2.7 Rule 
      AddExpression<BR>6.2.8 Rule MulExpression<BR>6.2.9 Rule 
      UnaryExpression<BR>6.2.10 Rule ExpExpression<BR></FONT></MENU><FONT 
    face=Arial>6.3 Rule Factor<BR></FONT>
    <MENU><FONT face=Arial>6.3.1 Emitting code for a literal constants 
      <BR>6.3.2 Emitting code for a literal string constant <BR>6.3.3 Other 
      Things Factor Does <BR></FONT></MENU><FONT face=Arial>6.4 Rule 
    IdentExpr<BR></FONT>
    <MENU><FONT face=Arial>6.4.1 Symbolic Constants<BR>6.4.2 Variables 
      <BR>6.4.3 Type Conversion <I>(Optional Section)</I><BR>6.4.4 Summary of 
      <TT>RuleIdentExpr()</TT><BR></FONT></MENU><FONT face=Arial>6.5 Arrays and 
    Records: Rule Designator</TT><BR></FONT>
    <MENU><FONT face=Arial>6.5.1 The Base Identifier<BR>6.5.2 Rule 
      Designator<BR>6.5.3 Array Subscripts<BR>6.5.4 Record Fields<BR>6.5.5 
      Nesting Arrays and Records<BR></FONT></MENU><FONT face=Arial>6.6 The Code 
    Generation Library<BR>6.7 Conclusion<BR>6.8 Artifacts<BR></FONT></MENU>
  <P><FONT face=Arial>7 </FONT><A 
  href="http://topaz.cs.byu.edu/text/html/Textbook/Chapter7/index.html"><FONT 
  face=Arial>Code Generation for Control Statements</FONT> </A><BR>
  <MENU><FONT face=Arial>7.1 If Statement<BR>7.2 Pre-Test Loop<BR>7.2 
    Post-Test Loop<BR>7.3 For Loop<BR>7.4 Select Statement<BR></FONT>
    <MENU><FONT face=Arial>7.4.1 Rule SelectStatment<BR>7.4.2 Rule 
      Case<BR>7.4.3 Rule CaseLabelList<BR>7.4.4 Summary: Rule 
      SelectStatement<BR></FONT></MENU><FONT face=Arial>7.5 Input and Output, 
    System calls<BR></FONT>
    <MENU><FONT face=Arial>7.5.1 The <TT>SYS</TT> Instruction<BR>7.5.1 
      Implementing <TT>read</TT> and <TT>write</TT><BR></FONT></MENU></MENU>
  <P><FONT face=Arial>8 </FONT><A 
  href="http://topaz.cs.byu.edu/text/html/Textbook/Chapter8/index.html"><FONT 
  face=Arial>Code Generation for Procedures and Functions</FONT> </A><BR>
  <MENU><FONT face=Arial>8.1 Procedures and Functions<BR></FONT>
    <MENU><FONT face=Arial>8.1.1 The <TT>ENTR</TT> Instruction<BR>8.1.2 
      Storing Parameters<BR>8.1.3 Allocating Local Arrays and Records<BR>8.1.4 
      Procedure Body<BR>8.1.3 The <TT>RTN</TT> Instruction and 
      <TT>PutCodeText()</TT><BR></FONT></MENU><FONT face=Arial>8.2 Calling a 
    Procedure<BR></FONT>
    <MENU><FONT face=Arial>8.2.1 Calling Local Procedures<BR>8.2.2 Calling 
      External Procedures<BR>8.2.3 Calling a Nested 
    Procedure<BR></FONT></MENU><FONT face=Arial>8.3 Rule ReturnStatement<BR>8.4 
    Rule CompilationUnit<BR></FONT>
    <MENU><FONT face=Arial>8.4.1 Boolean Flag<BR>8.4.2 Calling 
      <TT>PrepareObjFile()</TT><BR>8.4.3 Calling <TT>ModuleInit()</TT><BR>8.4.4 
      Generate Code For the Main Procedure<BR>8.4.5 Initialize Imported 
      Libraries<BR>8.4.6 Allocate Local Arrays and Records<BR>8.4.7 Call 
      <TT>RuleStatementSequence()</TT><BR>8.4.8 Finishing the Module's Main 
      Procedure<BR>8.4.9 Close the Object File<BR></FONT></MENU></MENU>
  <P>
  <H2><FONT face=Arial>Part IV: Advanced Features</FONT> </H2><FONT face=Arial>9 
  </FONT><A 
  href="http://topaz.cs.byu.edu/text/html/Textbook/Chapter9/index.html"><FONT 
  face=Arial>Designing Classes</FONT> </A><BR>
  <MENU><FONT face=Arial>9.1 Lightweight Classes<BR></FONT>
    <MENU><FONT face=Arial>9.1.1 External Member Access<BR>9.1.2 External 
      Method Access<BR>9.1.3 Internal Member and Method Access<BR>9.1.4 
      Implementing Lightweight Classes<BR></FONT></MENU><FONT face=Arial>9.2 
    Inheritance<BR></FONT>
    <MENU><FONT face=Arial>9.2.1 Single Inheritance<BR>9.2.2 Multiple 
      Inheritance<BR>9.2.3 Shared Multiple Inheritance<BR>9.2.4 Member and 
      Method Access in Multiple Inheritance<BR>9.2.5 Parsing SAL 
      Inheritance<BR>9.2.6 Symbol Tables for SAL Inheritance<BR>9.2.7 Code 
      Generation for SAL Inheritance<BR>9.2.8 Meta-Constructors for Arrays and 
      Records<BR></FONT></MENU><FONT face=Arial>9.3 Conclusion<BR></FONT></MENU>
  <P><FONT face=Arial>10 </FONT><A 
  href="http://topaz.cs.byu.edu/text/html/Textbook/Chapter10/index.html"><FONT 
  face=Arial>Virtual Methods</FONT> </A><BR>
  <MENU><FONT face=Arial>10.1 What are Virtual Methods?<BR></FONT>
    <MENU><FONT face=Arial>10.1.1 Virtual Methods and 
    Shadowing<BR></FONT></MENU><FONT face=Arial>10.2 How Virtual Methods 
    Work<BR></FONT>
    <MENU><FONT face=Arial>10.2.1 Virtual Methods in Single 
      Inheritance<BR>10.2.2 Virtual Methods in Multiple Inheritance<BR>10.2.3 
      Virtual Methods With Shared Inheritance<BR></FONT></MENU><FONT 
    face=Arial>10.3 Implementation of Virtual Procedures and 
Functions<BR></FONT>
    <MENU><FONT face=Arial>10.3.1 Parsing for Virtual Procedures and 
      Functions<BR>10.3.2 Symbol Tables for Virtual Procedures and 
      Functions<BR>10.3.3 Code Generation for Virtual Procedures and 
      Functions<BR></FONT></MENU><FONT face=Arial>10.4 Conclusion and Further 
    Reading<BR></FONT></MENU>
  <P><FONT face=Arial>11 </FONT><A 
  href="http://topaz.cs.byu.edu/text/html/Textbook/Chapter11/index.html"><FONT 
  face=Arial>Constructors and Destructors</FONT> </A><BR>
  <MENU><FONT face=Arial>11.1 Constructing a Class<BR>11.2 The Meta 
    Constructor<BR></FONT>
    <MENU><FONT face=Arial>11.2.1 Init Flag for Virtual Base Classes<BR>11.2.2 
      Virtual Table Pointer Initialization<BR>11.2.3 Initialize all Member 
      Classes<BR>11.2.4 Call the Constructor of the Most-Derived 
    Class<BR></FONT></MENU><FONT face=Arial>11.3 Class Constructors<BR></FONT>
    <MENU><FONT face=Arial>11.3.1 Constructors in SAL<BR>11.3.2 Constructor 
      Calling Order<BR></FONT></MENU><FONT face=Arial>11.4 Arrays and Records 
    Containing Classes<BR>11.5 Conclusion<BR></FONT></MENU>
  <P><FONT face=Arial>12 </FONT><A 
  href="http://topaz.cs.byu.edu/text/html/Textbook/Chapter12/index.html"><FONT 
  face=Arial>Exceptions</FONT></A><BR><I>
  <MENU><FONT face=Arial>Exception Overview<BR>Methodologies<BR>SAL 
    Exceptions<BR></FONT>
    <MENU><FONT face=Arial>Try and Catch<BR>Throw: Unwinding the 
      Stack<BR></FONT></MENU><FONT face=Arial>Cleanup Local Variables<BR>Catching 
    Values<BR></FONT>
    <MENU><FONT face=Arial>Using Existing Structure<BR>Basic RTTI 
      Methods<BR></FONT></MENU></MENU></I>
  <P><I><FONT face=Arial>13 Break and Continue<BR></FONT></P><FONT face=Arial>
  <P><FONT face=Arial>14 </FONT><A 
  href="http://topaz.cs.byu.edu/text/html/Textbook/Chapter14/index.html"><FONT 
  face=Arial>Pointers</FONT> </A><BR>
  <MENU><FONT face=Arial>14.1 Overview<BR></FONT><FONT face=Arial>14.2 
    Pointers in SAL<BR></FONT><FONT face=Arial>14.3 Declarations<BR></FONT>
    <MENU><FONT face=Arial>10.3.1 Parsing for Virtual Procedures and 
      Functions<BR>10.3.2 Symbol Tables for Virtual Procedures and 
      Functions<BR>10.3.3 Code Generation for Virtual Procedures and 
      Functions<BR></FONT></MENU><FONT face=Arial>14.4 Assignment and Type 
    Checking<BR></FONT>
    <MENU><FONT face=Arial>14.4.1 The null Constant<BR>14.4.2 Rule 
      Assignment<BR>14.4.3 Parameter Passing<BR></FONT></MENU><FONT 
    face=Arial>14.5 GetPointerLevel<BR></FONT><FONT face=Arial>14.6 
    IdentExpression: For Pointers<BR></FONT>
    <MENU><FONT face=Arial>14.6.1 Symbolic Constants<BR>14.6.2 Variables<BR>
      <MENU><FONT face=Arial>14.6.2.1 A Variable's Storage 
        Location<BR>14.6.2.2 Operations on a Variable<BR>14.6.2.3 Short Example 
        <BR></MENU>14.6.3 Complex Types<BR>14.6.3 Function Calls and Type 
      Casting<BR>14.6.5 Summary<BR></FONT></MENU><FONT face=Arial>14.7 Memory 
    Management<BR></FONT>
    <MENU><FONT face=Arial>14.7.1 Rule New<BR>14.7.2 Rule 
    Delete<BR></FONT></MENU></MENU>
  <P></FONT></I><FONT face=Arial>Part V: Appendicies</FONT></P></MENU>
<MENU><FONT face=Arial>Appendix A: </FONT><A 
  href="http://topaz.cs.byu.edu/text/html/Textbook/AppendixA/index.html"><FONT 
  face=Arial>Debugging and Virtual Machine Architecture</FONT> </A><FONT 
  face=Arial>*****<BR></FONT>
  <MENU><FONT face=Arial>A.1 Debugging a SAL Program<BR>A.2 Virtual Machine 
    Architecture<BR></FONT></MENU>
  <P><FONT face=Arial>Appendix B: </FONT><A 
  href="http://topaz.cs.byu.edu/text/html/Textbook/AppendixB/index.html"><FONT 
  face=Arial>The SALVM Instruction Set</FONT> </A><BR>
  <MENU><FONT face=Arial>B.1 Loading and Storing Instructions<BR></FONT>
    <MENU><FONT face=Arial>B.1.1 Immediate values<BR>B.1.2 Local Data 
      Area<BR>B.1.3 Global Data Within the Same Module<BR>B.1.4 Global Data 
      Within an External Module<BR>B.1.5 Using a pointer on the EES<BR>B.1.6 
      Computing Pointers<BR>B.1.7 Accessing Other Registers and Memory 
      Segments<BR>B.1.8 Using These Instructions Together<BR></FONT></MENU><FONT 
    face=Arial>B.2 Integer and Floating Point Arithmetic Instructions<BR>B.3 
    Increment and Decrement Instructions<BR>B.4 Bit Operation 
    Instructions<BR>B.5 Conversion Instructions<BR></FONT>
    <MENU><FONT face=Arial>B.5.1 Precision Conversion<BR>B.5.2 Data Type 
      Conversion<BR></FONT></MENU><FONT face=Arial>B.6 Bit Comparison 
    Instructions<BR>B.7 Flow Control Instructions<BR>B.8 Procedural 
    Instructions<BR>B.8 Miscellaneous Instructions<BR></FONT></MENU>
  <P><FONT face=Arial>Appendix C: System level calls<BR></FONT>
  <P><FONT face=Arial>Appendix D: </FONT><A 
  href="http://topaz.cs.byu.edu/text/html/Textbook/AppendixD/index.html"><FONT 
  face=Arial>PRG and RLL Specification</FONT> </A><BR>
  <P><FONT face=Arial>Appendix E: </FONT><A 
  href="http://topaz.cs.byu.edu/text/html/Textbook/AppendixE/index.html"><FONT 
  face=Arial>SAL Syntax diagrams</FONT> </A><BR>
  <P><FONT face=Arial>Appendix F: SAL Standard Libraries<BR></FONT>
  <P><FONT face=Arial>Reference Documentation: </FONT><A 
  href="http://topaz.cs.byu.edu/text/html/Textbook/Reference/index.html"><FONT 
  face=Arial>Additional Reference Documentation</FONT> </A><BR>
  <P></P></MENU></B>
<P>
<P>
<P></P></FONT></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -