Compiler Design feels like unrelated subjects when phases, regular expressions, FIRST/FOLLOW, LR items, syntax-directed translation and optimisation sit in separate notes. Study phases, regular expressions, FIRST/FOLLOW, LR items, syntax-directed translation and optimisation in prerequisite order across six weeks. Reserve eight hours each week, use one recurring source statement, and apply the recovery rule when sessions are missed. Use it with your wider GATE CS preparation, without assuming any official topic weight or question frequency.
Fix the study clock before choosing topics
Reserve 8 hours/week, or 48 hours total: Monday 75 minutes for concepts, Wednesday 75 for derivations, Friday 90 for problems, Saturday 120 for timed practice, Sunday 60 for the error log, plus a 60-minute recovery buffer. Check: 75 + 75 + 90 + 120 + 60 + 60 = 480 minutes = 8 hours.
Start with a 12-question, 36-minute closed-note diagnostic: three each on lexical analysis, top-down parsing, bottom-up parsing, and semantics/intermediate code/optimisation. For 7 correct, 3 wrong, 2 skipped, attempted accuracy is 7/10 = 70%. A 0/3 or 1/3 bucket uses Sunday's buffer, 2/3 needs review, and 3/3 gets one recall check. Diagnosis changes practice time, not concept order. GATE Guidance by Sanchit Sir offers wider structure.

Week 1: Compiler phases and lexical analysis
Trace total = base + 3 * 4; with base = 5. The lexical analyser emits eight tokens: <id,total>, <assign,=>, <id,base>, <plus,+>, <num,3>, <mul,*>, <num,4>, <semi,;>. The symbol table holds integer identifiers total and base. Multiplication first gives 3 * 4 = 12, then total = 5 + 12 = 17.
Apply [A-Za-z_][A-Za-z0-9_]* to sum_2 = 19 + value;. Longest match accepts lexemes sum_2 and value; 19 is numeric, while =, +, ; are tokens. Token means category; lexeme means matched text. Monday: phases; Wednesday: patterns; Friday: traces; Saturday: 15 questions in 60 minutes plus 60 review. Sunday's log has mistake, why, correct rule, redo date.
Week 2: Grammar, FIRST/FOLLOW and predictive parsing
Use E -> T E', E' -> + T E' | epsilon, T -> id. Derive FIRST(E) = {id}, FIRST(E') = {+, epsilon}, FIRST(T) = {id}, FOLLOW(E) = {$}, FOLLOW(E') = {$}, and FOLLOW(T) = {+, $}. The populated entries are M[E,id] = E -> T E', M[E',+] = E' -> + T E', M[E',$] = E' -> epsilon, and M[T,id] = T -> id.
For id + id $, start with E $: E -> T E', T -> id, match id, E' -> + T E', match +, T -> id, match id, E' -> epsilon, accept on $. Rebuild everything in 12 minutes closed-note. Monday: grammar cleanup and left recursion; Wednesday: FIRST/FOLLOW; Friday: table and trace; Saturday: 10 questions in 60 minutes plus 60 review; Sunday: repair. FIRST and FOLLOW in Compiler Design adds examples.
Week 3: Bottom-up parsing without memorising labels
For S' -> S, S -> C C, C -> c C | d, write all seven LR(0) sets:
I0 = {S' -> .S, S -> .CC, C -> .cC, C -> .d};I1 = {S' -> S.}I2 = {S -> C.C, C -> .cC, C -> .d};I3 = {C -> c.C, C -> .cC, C -> .d}I4 = {C -> d.};I5 = {S -> CC.};I6 = {C -> cC.}
Transitions are I0: S -> I1, C -> I2, c -> I3, d -> I4; I2: C -> I5, c -> I3, d -> I4; I3: C -> I6, c -> I3, d -> I4. Trace c d d $: shift c, shift first d, reduce C -> d, reduce C -> c C, shift second d, reduce C -> d, reduce S -> C C, accept. The machine recognises viable prefixes, not grammar derivations.
Monday: closure/goto; Wednesday: seven states; Friday: trace; Saturday: 8 comparison or construction problems in 80 minutes plus 40 review; Sunday: conflict log. SLR, CLR and LALR parsers compared separates item construction, lookaheads and state merging.
Week 4: Semantics, translation and intermediate code
For x = (a + b) * (c - d), with a = 7, b = 5, c = 10, d = 4: t1 = a + b = 12; t2 = c - d = 6; t3 = t1 * t2 = 72; x = t3 = 72. Quadruples are (+, a, b, t1), (-, c, d, t2), (*, t1, t2, t3), (=, t3, -, x).
Label identifiers and temporaries int; expression nodes synthesise a value/place, and assignment checks the result fits x. Quadruples name results, triples use operation positions, and indirect triples add pointers. Monday: checks; Wednesday: attributes; Friday: trace; Saturday: 10 conversions in 70 minutes plus 50 review; Sunday: ordering errors.
Week 5: Runtime storage and code optimisation
Sketch main -> fact(3) -> fact(2) -> fact(1). Maximum depth has four active frames including main. Label parameters, return address, local data and control link. Then fact(1) returns 1, fact(2) returns 2, and fact(3) returns 6.
Optimise t1 = 3 * 4; t2 = x + t1; t3 = x + 12; y = t2 + t3. Folding gives 12; propagation exposes repetition. Common-subexpression elimination and dead-code cleanup leave t2 = x + 12; y = t2 + t2. With x = 5, both versions give t2 = t3 = 17, then y = 34. Optimisation must preserve observable meaning.
Monday: storage; Wednesday: flow graphs; Friday: optimisation; Saturday: 10 problems in 70 minutes plus 50 review; Sunday: classify errors as data-flow, algebra or unsafe transformation.
Week 6: Mixed practice, recovery and revision
Take 20 mixed questions in 60 minutes, then review for 60. A sample 13 correct, 4 wrong, 3 skipped gives attempted accuracy 13/17 = 76.47%. Classify errors as two concept, one derivation and one haste; redo all four after 48 hours, targeting 4/4. This is a study set, not an official format or marking scheme.
Friday, rebuild the eight Week 1 tokens, Week 2 sets, seven LR(0) states, and two-statement block giving y = 34. Saturday, solve 25 questions in 75 minutes and review for 45. Sunday serves only the weakest red bucket. If 120 Saturday minutes were missed, use a 60-minute Sunday buffer and carry only 60; never double the next day.
The short version
Learn in dependency order, trace each topic, record error causes, and redo later. KnowledgeGate has 700+ Compiler Design questions available in its practice bank. Use the




