∑GateAndNet
PlannerSign Up
🛠️GATE CSWeightage: 5–6 Marks3 Study Chapters12 Solved PYQs

Compiler Design

Lexical analysis, FIRST/FOLLOW, LL(1) & LR(0)/SLR/LALR/CLR parsers, SDT & liveness analysis.

Practice Unit PYQs (12)All GATE CS Units
Official Syllabus Micro-Topics
Lexical Analysis: Tokens, Regular Expressions & Maximal Munch RuleTop-Down Parsing: Left Recursion Elimination, Left Factoring, FIRST & FOLLOW Sets, LL(1) TableBottom-Up Parsing: Handle Pruning, Shift-Reduce & Reduce-Reduce ConflictsLR Parser Family: LR(0), SLR(1), LALR(1) & Canonical LR(1) State Counts & Expressive PowerSyntax-Directed Translation (SDT): Synthesized vs Inherited Attributes, S-Attributed & L-Attributed DefinitionsIntermediate Code Generation: Three-Address Code (TAC), DAG Representation, Basic Blocks & Control Flow GraphsData-Flow Analysis: Constant Propagation, Liveness Analysis & Register Allocation via Graph Coloring

Published Study Notes & Chapters (3)

Ch 1 High Yield 4 min read 6 PYQs

LL(1) & LR(0), SLR(1), LALR(1), CLR(1) Parsing Power & Conflicts

FIRST/FOLLOW rules, parsing hierarchy Venn relationships, state count equality between SLR(1) and LALR(1), and ambiguity.

Read Chapter
Ch 2 High Yield 4 min read 4 PYQs

Syntax-Directed Translation (SDT), Three-Address Code & Register Liveness

Synthesized vs Inherited attributes, S-attributed vs L-attributed SDTs, Basic Block leader identification, SSA static single assignment, and Chaitin register interference graph coloring.

Read Chapter
Ch 3 High Yield 4 min read 2 PYQs

Compilers 2027 Rank-Decider: Basic-Block Leaders, SSA Phi-Functions, Dominators & Graph Coloring

Exact 3-rule Basic-Block Leader algorithm, Control-Flow Dominator trees & Natural Loops, Static Single Assignment (SSA) minimal phi-nodes, backward Liveness fixpoint, and Chaitin k-coloring.

Read Chapter

Solved Compiler Design PYQs & Practice Questions

Launch Timed Mock (12 Qs)
Q1GATE CS 2024 Set-1Compiler DesignMCQMEDIUM
+2M • -0.67

For the grammar S→aAb∣bBa,  A→ϵ,  B→ϵS \to aAb \mid bBa,\; A \to \epsilon,\; B \to \epsilon, is the grammar LL(1) and/or SLR(1)?

⚡ Click an option above to verify instantly
Q2GATE CS 2022Compiler DesignMCQMEDIUM
+2M • -0.67

Consider a grammar that is LR(1) (CLR) and therefore unambiguous. When we merge LR(1) states sharing identical LR(0) cores to construct the LALR(1) parser, which new conflict(s) can possibly be introduced?

⚡ Click an option above to verify instantly
Q3GATE CS CompilerCompiler DesignMCQEASY
+2M • -0.67

How many lexical tokens does a C lexical analyzer emit for the statement: printf("i = %d, &i = %x", i, &i);?

⚡ Click an option above to verify instantly
Q4GATE CS CompilerCompiler DesignMCQMEDIUM
+2M • -0.67

If a Context-Free Grammar GG is ambiguous, which of the following statements is guaranteed to be TRUE?

⚡ Click an option above to verify instantly
Q5GATE CS CompilerCompiler DesignMCQEASY
+1M • -0.33

Which pair of bottom-up LR parsers always have the exact same number of states for any given context-free grammar?

⚡ Click an option above to verify instantly
Q6GATE CS Compiler PYQCompiler DesignMCQMEDIUM
+2M • -0.67

Which of the following statements about bottom-up LR parsers is FALSE?

⚡ Click an option above to verify instantly
Q7GATE CS 2021 Set-2Compiler DesignNATMEDIUM
+2M • 0 Neg

Consider the Syntax-Directed Definition: E→E1 # T  {E.val=E1.val×T.val}∣TE \to E_1 \text{ \texttt{\#} } T \;\{E.val = E_1.val \times T.val\} \mid T, and T→T1 & F  {T.val=T1.val+F.val}∣FT \to T_1 \text{ \texttt{\&} } F \;\{T.val = T_1.val + F.val\} \mid F, with F→numF \to \mathbf{num}. Notice + (&) has higher precedence than * (#) and both are left-associative! Evaluate 2 # 3 & 5 # 4 & 1.

Q8GATE CS 2020Compiler DesignNATEASY
+1M • 0 Neg

How many lexical tokens are produced by a standard C lexical analyzer (using Maximal Munch) on the statement: printf("i = %d, &i = %x", i, &i);?

Solve All 12 Compiler Design Questions
Other Units in GATE Computer Science & Information Technology (GATE CS)
∑ Engineering Mathematics & Discrete Math🔌 Digital Logic🏗️ Computer Organization & Architecture💻 Programming & Data Structures⚡ Algorithms🔄 Theory of Computation🛠️ Compiler Design⚙️ Operating Systems🗄️ Databases (DBMS)🌐 Computer Networks🧭 General Aptitude (Mandatory)