# CST 302 - COMPILER DESIGN
**Category:** PCC
**Lecture:** 3 | **Tutorial:** 1 | **Practical:** 0 | **Credit:** 4
**Year of Introduction:** 2019
## Syllabus
### Module 1 - Introduction to compilers and lexical analysis
- Analysis of the source program
- Analysis and synthesis phases
- Phases of a compiler
- Compiler writing tools
- Bootstrapping
- Lexical Analysis
- Role of Lexical Analyzer
- Input Buffering
- Specification of Tokens
- Recognition of Tokens
### Module 2 - Introduction to Syntax Analysis
- Role of the Syntax Analyzer
- Syntax error handling
- Review of Context-Free Grammars
- Derivation and Parse Trees
- Eliminating Ambiguity
- Basic parsing approaches
- Eliminating left recursion
- Left factoring
- Top-Down Parsing
- Recursive Descent parsing
- Predictive Parsing
- LL(1) Grammars
### Module 3 - Bottom-Up Parsing
- Handle Pruning
- Shift Reduce parsing
- Operator precedence parsing (Concept only)
- LR parsing
- Constructing SLR, LALR, and canonical LR parsing tables
### Module 4 - Syntax directed translation and Intermediate code generation
- Syntax directed translation
- Syntax directed definitions
- S-attributed definitions
- L-attributed definitions
- Bottom-up evaluation of S-attributed definitions
- Run-Time Environments
- Source Language issues
- Storage organization
- Storage-allocation strategies
- Intermediate Code Generation
- Intermediate languages
- Graphical representations
- Three-Address code
- Quadruples
- Triples
### Module 5 - Code Optimization and Generation
- Code Optimization
- Principal sources of optimization
- Machine dependent and machine independent optimizations
- Local and global optimizations
- Code generation
- Issues in the design of a code generator
- Target Language
- A simple code generator
## Textbooks
1. Aho A.V., Ravi Sethi, and D. Ullman. "Compilers – Principles Techniques and Tools," Addison Wesley, 2006.
## Reference Books
1. D.M.Dhamdhere. "System Programming and Operating Systems," Tata McGraw Hill & Company, 1996.
2. Kenneth C. Louden. "Compiler Construction – Principles and Practice," Cengage Learning Indian Edition, 2006.