01
Unit 1: Compiler Structure and Lexical Analysis
Role of compilers vs interpreters, Phases of compiler (lexical, syntax, semantic, optimization, code generation), Symbol tables and their organization (hash tables, trees), Lexical analysis fundamentals connecting to finite automata (DFA/NFA from CS203), Regular expressions to NFA conversion, Lexical analyzer generators (Lex/Flex tool overview), Token classification and symbol table management, Handling identifiers, keywords, literals, and comments.
02
Unit 2: Top-Down and Bottom-Up Parsing
Parsing as recognition problem (connecting CFG from CS203 to practical parsing), Top-down parsing (recursive descent, LL(1) parsers, FIRST/FOLLOW sets), Handling left recursion and left factoring, Predictive parsing tables, Bottom-up parsing (shift-reduce, LR(0), SLR(1), LALR(1), CLR(1)), Handle finding and parsing conflicts (shift-reduce, reduce-reduce), Parser generators (Yacc/Bison tool overview).
03
Unit 3: Syntax-Directed Translation and Semantics
Syntax-directed definitions (S-attributed, L-attributed), Syntax-directed translation schemes, Abstract syntax trees (AST) construction, Semantic analysis connecting to Programming Methodology paradigms (CS206), Type systems (static/dynamic typing, type equivalence, type inference), Type checking algorithms (structural/declarative), Symbol table operations during semantic analysis, Attribute grammars for semantic rules.
04
Unit 4: Intermediate Code Generation and Runtime
Three-address code (TAC) forms (triple, indirect triple), Syntax trees to TAC translation, Boolean expressions and control flow (DAG construction), Runtime environments (activation records, stack allocation), Parameter passing mechanisms (call-by-value/reference), Storage allocation (static/dynamic, heap management), Garbage collection basics (mark-and-sweep, reference counting), Intermediate representations (IR) for optimization preparation.
05
Unit 5: Code Optimization and Generation
Local optimization (constant folding, strength reduction, common subexpression elimination), Global optimization (data flow analysis - reaching definitions, live variables, available expressions), Control flow graphs and dominators, Loop optimizations (invariant code motion, induction variable elimination), Register allocation (graph coloring, spilling), Instruction selection and peephole optimization, Target machine characteristics and code generation strategies.