SGBAU · Third Year B.E. Computer Science and Engineering · NEP 2020
Compiler Design
5CS221PC · Semester V · 3 credits · IE 40 + ESE 60
Unit 1: Introduction to Compilers
6 hoursLanguage processors and the structure of a compiler; lexical analysis — the role of the lexical analyser, input buffering, specifying and recognising tokens, and the Lex generator.
Examined in the 60-mark end-semester paper
- Language processors: compilers, interpreters, assemblers, linkers and loaders
- Phases of a compiler
- Role of the lexical analyser and input buffering
- Specifying and recognising tokens
- Lex and Flex
Unit 2: Syntax Analysis
6 hoursThe role of the parser, context-free grammars, parse trees and derivations, ambiguity, eliminating left recursion and left factoring; recursive-descent and predictive parsing, FIRST and FOLLOW, LL(1) grammars, non-recursive predictive parsing and error recovery.
Examined in the 60-mark end-semester paper
- Top-down parsing: recursive descent and LL(1)
- FIRST and FOLLOW sets and predictive parsing tables
- Error detection and recovery in compilers
- Ambiguous grammars
Unit 3: Bottom-Up Parsing
6 hoursHandle pruning and shift-reduce parsing with a stack and its conflicts; LR parsing — LR(0) items and automaton, the LR algorithm and SLR tables; canonical LR(1) items and tables, and LALR tables.
Examined in the 60-mark end-semester paper
- Bottom-up parsing and shift-reduce
- LR parsers: SLR, CLR and LALR
Unit 4: Syntax-Directed Translation
6 hoursSyntax-directed definitions, inherited and synthesised attributes, evaluation orders and dependency graphs, S-attributed and L-attributed definitions, building syntax trees, and syntax-directed translation schemes.
Examined in the 60-mark end-semester paper
- Syntax-directed definitions and translation schemes
- S-attributed and L-attributed definitions
Unit 5: Intermediate Code Generation
6 hoursVariants of syntax trees — DAGs — and three-address code; run-time environments: storage organisation, static versus dynamic allocation, stack allocation, activation trees and records, calling sequences, and the design goals of garbage collectors.
Examined in the 60-mark end-semester paper
- Intermediate code: syntax trees, postfix and three-address code
- DAG representation of basic blocks
- Run-time storage organisation and activation records
- Storage allocation strategies
- Dynamic storage allocation
Unit 6: Code Generation
6 hoursIssues in code-generator design, the target language and addresses in target code, basic blocks and flow graphs, optimising basic blocks, peephole optimisation, and the principal sources of optimisation — global common subexpressions, copy propagation and dead-code elimination.
Examined in the 60-mark end-semester paper
- Code generator design and the target machine
- Basic blocks and flow graphs
- Peephole optimisation
- Machine-independent optimisations
Unit contents are summarised from the official SGBAU syllabus . AiCanCode.org is not affiliated with Sant Gadge Baba Amravati University (SGBAU).