具體描述
				
				
					
編輯推薦
    
       內容簡介
       《編譯原理》是編譯領域無可替代的經典著作,被廣大計算機專業人士譽為“龍書”。《編譯原理》上一版自1986年齣版以來,被世界各地的著名高等院校和研究機構(包括美國哥倫比亞大學、斯坦福大學、哈佛大學、普林斯頓大學、貝爾實驗室)作為本科生和研究生的編譯原理課程的教材。該書對我國高等計算機教育領域也産生瞭重大影響。
    第2版對每一章都進行瞭全麵的修訂,以反映自上一版齣版二十多年來軟件工程、程序設計語言和計算機體係結構方麵的發展對編譯技術的影響。
    《編譯原理》全麵介紹瞭編譯器的設計。並強調編譯技術在軟件設計和開發中的廣泛應用,每章中都包含大量的習題和豐富的參考文獻。《編譯原理》適閤作為高等院校計算機專業本科生和研究生的編譯原理與技術課程的教材,也可供廣大計算機技術人員參考。     作者簡介
       AlfredV.Aho,美國哥倫比亞大學教授。美國國傢工程院院士,ACM和lEEE會士,曾獲得IEEE的馮·諾伊曼奬。著有多部算法、數據結構、編譯器、數據庫係統及計算機科學基礎方麵的著作。
    MonicaS.Lam,斯坦福大學計算機科學係教授。曾任T'ensilica的首席科學傢,也是Moka5的首任CEO。曾經主持SLJIF項目。
    Ravi Sethi,Avaya實驗室總裁。曾任貝爾實驗室高級副總裁和LLicentTectlIlologies通信軟件的CTO。他曾在賓夕法尼亞州立大學、亞利桑那州立大學和普林斯頓大學任教,是ACM會士。
    Jeffrey D.UIIman,斯坦福大學計算機科學係教授和GradianceCEO。他的研究興趣包括數據庫理論、數據庫集成、數據挖掘和利用信息基礎設施教學等。他是美國國傢工程院院士、IEEE會士,獲得過ACM的Karlstrom傑齣教育奬和Knufh奬。     目錄
   1 introduction
1.1 language processors
1.2 the structure of a compiler
1.3 the evolution of programming languages
1.4 the science of building a compiler
1.5 applications of compiler technology
1.6 programming language basics
1.7 summary of chapter 1
1.8 references for chapter 1
2 a simple syntax-directed translator
2.1 introduction
2.2 syntax definition
2.3 syntax-directed translation
2.4 parsing
2.5 a translator for simple expressions
2.6 lexical analysis
2.7 symbol tables
2.8 intermediate code generation
2.9 summary of chapter 2
3 lexical analysis
3.1 the role of the lexical analyzer
3.2 input buffering
3.3 specification of tokens
3.4 recognition of tokens
3.5 the lexical-analyzer generator lex
3.6 finite automata
3.7 from regular expressions to automata
3.8 design of a lexical-analyzer generator
3.9 optimization of dfa-based pattern matchers
3.10 summary of chapter 3
3.11 references for chapter 3
4 syntax analysis
4.1 introduction
4.2 context-free grammars
4.3 writing a grammar
4.4 top-down parsing
4.5 bottom-up parsing
4.6 introduction to lr parsing: simple lr
4.7 more powerful lr parsers
4.8 using ambiguous grammars
4.9 parser generators
4.10 summary of chapter 4
4.11 references for chapter 4
5 syntax-directed translation
5.1 syntax-directed definitions
5.2 evaluation orders for sdd's
5.3 applications of syntax-directed translation
5.4 syntax-directed translation schemes
5.5 hnplementing l-attributed sdd's
5.6 summary of chapter 5
5.7 references for chapter 5
6 intermediate-code generation
6.1 variants of syntax trees
6.2 three-address code
6.3 types and declarations
6.4 translation of expressions
6.5 type checking
6.6 control flow
6.7 backpatching
6.8 switch-statements
6.9 intermediate code for procedures
6.10 summary of chapter 6
6.11 references for chapter 6
7 run-time environments
7.1 storage organization
7.2 stack allocation of space
7.3 access to nonlocal data on the stack
7.4 heap management
7.5 introduction to garbage collection
7.6 introduction to trace-based collection
7.7 short-pause garbage collection
7.8 advanced topics in garbage collection
7.9 summary of chapter 7
7.10 references for chapter 7
8 code generation
8.1 issues m the design of a code generator
8.2 the target language
8.3 addresses in the target code
8.4 basic blocks and flow graphs
8.5 optimization of basic blocks
8.6 a simple code generator
8.7 peephole optimization
8.8 register allocation and assignment
8.9 instruction selection by tree rewriting
8.10 optimal code generation for expressions
8.11 dynamic programming code-generation
8.12 summary of chapter 8
8.13 references for chapter 8
9 machine-independent optimizations
9.1 the principal sources of optimization
9.2 introduction to data-flow analysis
9.3 foundations of data-flow analysis
9.4 constant propagation
9.5 partial-redundancy elimination
9.6 loops in flow graphs
9.7 region-based analysis
9.8 symbolic analysis
9.9 summary of chapter 9
9.10 references for chapter 9
10 instruction-level parallelism
10.1 processor architectures
10.2 code-scheduling constraints
10.3 basic-block scheduling
10.4 global code scheduling
10.5 software pipelining
10.6 summary of chapter 10
10.7 references for chapter 10
11 optimizing for parallelism and locality
11.1 basic concepts
11.2 matrix multiply: an in-depth example
11.3 iteration spaces
11.4 aftlne array indexes
11.5 data reuse
11.6 array data-dependence analysis
11.7 finding synchronization-free parallelism
11.8 synchronization between parallel loops
11.9 pipelining
11.10 locality optimizations
11.11 other uses of affine transforms
11.12 summarv of chapter 11
11.13 references for chapter 11
12 interprocedural analysis
12.1 basic concepts
12.2 why interprocedural analysis?
12.3 a logical representation of data flow
12.4 a simple pointer-analysis algorithm
12.5 context-insensitive interprocedural analysis
12.6 context-sensitive pointer analysis
12.7 datalog implementation by bdd's
12.8 summary of chapter 12
12.9 references for chapter 12
a a complete front end
a.1 the source language
a.2 main
a.3 lexical analyzer
a.4 symbol tables and types
a.5 intermediate code for expressions
a.6 jumping code for boolean expressions
a.7 intermediate code for statements
a.8 parser
a.9 creating the front end
b finding linearly independent solutions
index      精彩書摘
       Languagel, are used to search databases. Database queries consist of predicatescontaining relational and boolean operators. They can be interpreted or com-piled into commands to search a database for records satisfying that predicate.Compiled SimulationSimulation is a general technique used in many scientific and engineering disci-plines to understand a phenomenon or to validate a design. Inputs to a simula-tor usually include the description of the design and specific input parametersfor that particular simulation run. Simulations can be very expensive. We typi-cally need to simulate many possible design alternatives on many different inputsets, and each experiment may take days to complete on a high-performancemachine. Instead of writing a simulator that interprets the design, it is fasterto compile the design to produce machine code that simulates that particulardesign natively. Compiled simulation can run orders of magnitude faster thanan interpreter-based approach. Compiled simulation is used in many state-of-the-art tools that simulate designs written in Verilog or VHDL.1.5.5 Software Productivity ToolsPrograms are arguably the most complicated engineering artifacts ever pro-duced; they consist of many many details, every one of which must be correctbefore the program will work completely. As a result, errors are rampant inprograms; errors may crash a system, produce wrong results, render a systemvulnerable to security attacks, or even lead to catastrophic failures in criticalsystems. Testing is the primary technique for locating errors in programs.
    An interesting and promising complementary approach is to use data-flowanalysis to locate errors statically (that is, before the program is run). Data-flow analysis can find errors along all the possible execution paths, and notjust those exercised by the input data sets, as in the case of program testing.Many of the data-flow-analysis techniques, originally developed for compileroptimizations, can be used to create tools that assist programmers in theirsoftware engineering tasks.
    The problem of finding all program'errors is undecidable. A data-flow anal-ysis may be designed to warn the programmers of all possible statements witha particular category of errors. But if most of these warnings are false alarms,users will not use the tool. Thus, practical error detectors are often neithersound nor complete. That is, they may not find all the errors in the program,and not all errors reported are guaranteed to be real errors. Nonetheless, var-ious static analyses have been developed and shown to be effective in findingerrors, such as dereferencing null or freed pointers, in real programs. The factthat error detectors may be unsound makes them significantly different fromcompiler optimizations. Optimizers must be conservative and cannot alter thesemantics of the program under any circumstances.
    ……      前言/序言
     In the time since the 1986 edition of this book, the world of compiler designhas changed significantly. Programming languages have evolved to present newcompilation problems. Computer architectures offer a variety of resources ofwhich the compiler designer must take advantage. Perhaps most interestingly,the venerable technology of code optimization has found use outside compilers.It is now used in tools that find bugs in software, and most importantly, findsecurity holes in existing code. And much of the "front-end" technology ——grammars, regular expressions, parsers, and syntax-directed translators —— arestill in wide use.
  Thus, our philosophy from previous versions of the book has not changed.We recognize that few readers will build, or even maintain, a compiler for amajor programming language. Yet the models, theory, and algorithms associ-ated with a compiler can be applied to a wide range of problems in softwaredesign and software development. We therefore emphasize problems that aremost commonly encountered in designing a language processor, regardless ofthe source language or target machine.Use of the BookIt takes at least two quarters or even two semesters to cover all or most of thematerial in this book. It is common to cover the first half in an undergraduatecourse and the second half of the book —— stressing code optimization —— ina second course at the graduate or mezzanine level. Here is an outline of thechapters:Chapter 1 contains motivational material and also presents some backgroundissues in computer architecture and programming-language principles.Chapter 2 develops a miniature compiler and introduces many of the impor-taut concepts, which are then developed in later chapters. The compiler itselfappears in the appendix.Chapter 3 covers lexical analysis, regular expressions, finite-state machines, andscanner-generator tools. This material is fundamental to text-processing of allsorts.
 
alt="" />
    
				
				
				
					數據結構與算法實戰指南  內容簡介  本書是一本深入探討數據結構與算法的實踐性指南,旨在幫助讀者掌握解決復雜計算問題的核心工具與方法。本書不同於純理論的學術著作,它側重於將抽象的數據結構和算法概念轉化為實際可操作的代碼和解決策略,通過大量精選的實際案例,引導讀者理解數據結構與算法在軟件開發中的重要性以及它們如何有效地提升程序性能和效率。  核心內容概覽  本書的結構經過精心設計,從基礎概念的梳理到高級主題的深入剖析,層層遞進,循序漸進。  第一部分:數據結構基礎  本部分首先建立起堅實的數據結構理論基礎,但重點在於理解其背後的設計思想和應用場景。     數組與字符串: 從最基礎的綫性數據結構開始,本書不僅講解數組和字符串的定義、操作,更深入探討其在內存中的錶示方式、訪問效率以及它們在實際開發中(如文本處理、數據存儲)的應用。我們將學習如何利用數組實現動態分配、稀疏矩陣等,並分析字符串匹配算法(如樸素匹配、KMP算法)的原理和性能。    鏈錶: 鏈錶作為一種靈活的動態數據結構,在本書中被細緻地剖析。我們會詳細講解單嚮鏈錶、雙嚮鏈錶、循環鏈錶的實現,並著重分析它們在插入、刪除操作上的優勢,以及與數組在內存分配和訪問效率上的權衡。本書將通過實例展示鏈錶在實現棧、隊列、多項式運算等方麵的應用。    棧與隊列: 這兩種基本的數據結構在計算機科學中無處不在。本書不僅會介紹它們的LIFO(後進先齣)和FIFO(先進先齣)特性,更重要的是,我們將通過實際編程問題來體現它們的作用,例如使用棧實現錶達式求值、函數調用棧的模擬,以及使用隊列實現廣度優先搜索(BFS)和任務調度。    樹: 樹形結構是處理層次化數據的關鍵。本書將從二叉樹入手,深入講解二叉搜索樹(BST)的插入、刪除、查找操作,並探討其性能分析。隨後,我們將介紹平衡二叉搜索樹(如AVL樹、紅黑樹)的原理,以及它們如何通過自平衡機製保證查找效率。此外,堆(Heap)作為一種特殊的完全二叉樹,其在優先隊列和堆排序中的應用也將被詳盡闡述。    圖: 圖數據結構用於錶示對象之間的復雜關係。本書將係統介紹圖的幾種錶示方法(鄰接矩陣、鄰接錶),並在此基礎上深入講解經典的圖算法。我們將重點分析深度優先搜索(DFS)和廣度優先搜索(BFS)的遍曆過程及其在連通性判斷、拓撲排序等問題中的應用。  第二部分:經典算法與技巧  在掌握瞭基本的數據結構之後,本書將聚焦於解決問題的核心算法,並引入一係列高效的算法設計技巧。     排序算法: 排序是數據處理中最常見也是最基礎的操作。本書將詳細講解各種排序算法的實現原理、時間復雜度和空間復雜度。從簡單的冒泡排序、插入排序、選擇排序,到效率更高的快速排序、歸並排序、堆排序,再到特定的場景如基數排序、桶排序,本書都將提供清晰的解釋和代碼示例。更重要的是,我們將分析這些算法的適用場景以及在實際應用中的性能錶現。    查找算法: 除瞭數組和二叉搜索樹中的查找,本書還將探討更廣泛的查找技術。二分查找(Binary Search)作為提高查找效率的經典算法,其原理和應用將被深入解析。對於哈希錶(Hash Table),本書將詳細介紹哈希函數的設計、衝突解決策略(如鏈地址法、開放尋址法)以及其在常數平均時間復雜度下的查找、插入和刪除操作。    遞歸與分治: 遞歸是許多復雜算法的基石。本書將深入講解遞歸的定義、工作原理,並通過經典的例子,如斐波那契數列、漢諾塔、階乘等,幫助讀者掌握遞歸的思維方式。分治法(Divide and Conquer)作為一種重要的算法設計範式,其思想將在解決一些復雜問題時得到體現,如快速排序和歸並排序本身就是分治法的應用。    貪心算法: 貪心算法是一種局部最優選擇能夠導緻全局最優解的算法設計策略。本書將通過實例,如活動選擇問題、霍夫曼編碼、最小生成樹(Prim/Kruskal算法)等,展示貪心算法的應用。我們將重點分析貪心策略的設計以及證明其正確性的方法。    動態規劃: 動態規劃是解決具有重疊子問題和最優子結構特性的復雜問題的強大工具。本書將從最基礎的斐波那契數列開始,逐步引入動態規劃的核心思想:狀態定義、狀態轉移方程、最優解計算。我們將通過經典的動態規劃問題,如背包問題(0/1背包、完全背包)、最長公共子序列(LCS)、最短路徑(如Floyd-Warshall算法)、矩陣鏈乘法等,係統講解動態規劃的應用。本書會強調如何識彆一個問題是否適閤使用動態規劃,以及如何有效地設計狀態和轉移方程。  第三部分:高級主題與應用  在掌握瞭核心的數據結構和算法後,本書將進一步探討一些更高級的主題,以及數據結構與算法在實際工程中的應用。     字符串匹配算法: 除瞭前文提到的KMP算法,本書還將介紹其他高效的字符串匹配算法,如Boyer-Moore算法,並分析它們在不同場景下的性能特點。    圖算法進階: 在基礎圖遍曆之後,本書將深入探討更高級的圖算法,如最短路徑算法(Dijkstra算法、Bellman-Ford算法)、最小生成樹算法(Prim算法、Kruskal算法)、以及強連通分量(Tarjan算法/Kosaraju算法)等。這些算法在網絡路由、社交網絡分析、資源分配等領域有著廣泛的應用。    數據結構與算法在特定領域的應用: 本書還將探討數據結構與算法在實際開發中的具體應用,例如:        數據庫索引: B-tree和B+ tree等數據結構如何在數據庫中實現高效的數據檢索。        操作係統: 隊列在任務調度、進程管理中的作用;內存管理中的數據結構。        網絡協議: 哈希錶在緩存、路由錶中的應用。        圖形學: KD-tree在空間搜索中的應用。        機器學習: 各種特徵選擇、模型訓練中涉及的數據結構和算法。    性能優化與復雜度分析: 本書貫穿始終的重點是對算法的時間復雜度和空間復雜度進行精確分析,並指導讀者如何根據具體場景選擇最閤適的數據結構和算法來優化程序性能。我們將討論常數時間、對數時間、綫性時間、平方時間等不同復雜度等級的含義,以及如何通過減少冗餘計算、優化數據訪問模式來提升效率。  學習方法與特點  本書的編寫遵循以下核心原則:  1.  理論與實踐相結閤: 每介紹一種數據結構或算法,都將伴隨具體的代碼實現和詳細的僞代碼,並通過多個精心設計的實際問題來展示其應用。 2.  案例驅動: 大量精選的、來自實際編程挑戰的案例,讓讀者在解決問題的過程中學習和鞏固知識。 3.  清晰易懂的解釋: 復雜概念將以直觀易懂的方式進行闡述,輔以圖示和比喻,力求消除讀者的理解障礙。 4.  強調設計思想: 不僅關注“是什麼”,更關注“為什麼”,深入分析每種數據結構和算法的設計初衷、權衡取捨以及適用範圍。 5.  循序漸進: 從基礎概念到高級主題,內容組織邏輯清晰,難度逐步提升,適閤不同水平的讀者。  適用讀者  本書適閤以下人群:     計算機科學與技術專業的學生: 作為數據結構與算法課程的補充讀物,幫助理解理論知識並提升編程實踐能力。    軟件工程師: 旨在鞏固和提升自身在算法設計與數據結構運用方麵的技能,以應對更復雜、更高效的軟件開發挑戰。    準備技術麵試者: 數據結構與算法是各大科技公司麵試的重中之重,本書將提供係統性的復習和實戰指導。    對算法和編程感興趣的自學者: 渴望深入理解計算機科學核心概念,提升解決問題能力的學習者。  通過本書的學習,讀者不僅能掌握豐富的數據結構和算法知識,更能培養齣獨立分析問題、設計高效解決方案的能力,為未來的編程生涯打下堅實的基礎。