Chapter 1: Introduction to Compilers
1.1 Definition and Need for a Compiler
1.2 Structure of a Compiler
- Front-end and Back-end
1.3 Phases of Compilation
- Lexical, Syntax, Semantic, Intermediate Code, Optimization, Code Generation
1.4 Compiler vs Interpreter
1.5 Bootstrapping and Cross Compiler
Chapter 2: Lexical Analysis
2.1 Role of Lexical Analyzer
2.2 Tokens, Lexemes, and Patterns
2.3 Regular Expressions and Finite Automata
- DFA, NFA, Transition Diagrams
2.4 Lexical Errors and Recovery
2.5 Tools: LEX and Flex
Chapter 3: Syntax Analysis (Parsing)
3.1 Role of Syntax Analyzer
3.2 Context-Free Grammars (CFGs)
3.3 Parse Trees and Derivations
- Leftmost and Rightmost Derivations
3.4 Top-Down Parsing
- Recursive Descent, Predictive Parsing
3.5 Bottom-Up Parsing
- Shift-Reduce Parsing, LR(0), SLR, LALR Parsers
3.6 Error Recovery in Parsing
Chapter 4: Semantic Analysis
4.1 Syntax-Directed Translation
4.2 Attributes and Attribute Grammars
- Synthesized and Inherited Attributes
4.3 Type Checking and Type Systems
4.4 Symbol Tables
- Structure and Operations
4.5 Scope and Binding
Chapter 5: Intermediate Code Generation
5.1 Need for Intermediate Representation (IR)
5.2 Three-Address Code (TAC)
- Quadruples, Triples, Indirect Triples
5.3 Translation of Expressions and Statements
5.4 Control Flow Constructs
5.5 Backpatching
Chapter 6: Code Optimization
6.1 Need and Objectives of Optimization
6.2 Basic Blocks and Flow Graphs
6.3 Code Optimization Techniques
- Constant Folding, Dead Code Elimination, Loop Optimization, Strength Reduction
6.4 Peephole Optimization
6.5 Machine-Independent vs Dependent Optimization
Chapter 7: Code Generation
7.1 Issues in Code Generation
7.2 Target Machine Architecture
7.3 Instruction Selection
7.4 Register Allocation and Assignment
7.5 Generation of Code for Arithmetic Expressions
Chapter 8: Runtime Environment
8.1 Storage Organization
- Static, Stack, Heap
8.2 Activation Records and Call Stack
8.3 Parameter Passing Mechanisms
8.4 Memory Allocation and Deallocation
8.5 Garbage Collection
Chapter 9: Compiler Tools and Techniques
9.1 Lexical and Syntax Analyzer Generators (LEX & YACC)
9.2 Parser Generators
9.3 Debugging and Error Handling Tools
9.4 Case Studies: GCC, LLVM
9.5 Recent Trends in Compiler Design