IAE Academy

Compiler Design: notes and questions

For CSE/IT students

Notes for each topic, a formula sheet, practice questions and 36 past GATE questions from 10 papers (2018–2026), 35 of them solved step by step.

previous-year questions
36previous-year questions
solved step by step
35solved step by step
GATE papers, 2018–2026
10GATE papers, 2018–2026
topics with notes
6topics with notes

Foundation

Learn the subject one topic at a time. Each topic has notes, the key formulas and practice questions.

Topic notes and formulas

Notes on every topic, with the key formulas and practice.

  1. Compiler phases and lexical analysis

    A compiler translates source code in phases, and the first phase, lexical analysis, turns characters into tokens.

    5 practice questions

  2. Parsing: top-down and bottom-up parsers

    Parsing turns a stream of tokens into a parse tree by following a context-free grammar, either top-down (LL, building a leftmost derivation) or bottom-up (LR, building a rightmost derivation in reverse).

    5 practice questions

  3. Syntax-directed translation

    Syntax-directed translation attaches attributes and semantic rules (or embedded actions) to grammar productions so that a parser can compute values, build syntax trees, check types and emit code while it recognises the input.

    5 practice questions

  4. Runtime environments: activation records and storage allocation

    Runtime environments describe how a compiled program is laid out in memory while it runs: where code, static data, the stack and the heap live, what an activation record holds, and how a procedure finds its parameters, locals and non-local names.

    5 practice questions

  5. Intermediate code generation

    Intermediate code is the machine-independent form that sits between the front end and the back end of a compiler.

    5 practice questions

  6. Local optimisation and data-flow analysis

    Local optimisation improves code inside a basic block (common subexpressions via a DAG, constant folding, copy propagation, dead-code removal, peephole clean-ups), while data-flow analysis computes facts such as live variables, reaching definitions, available expressions and constants across the whole control-flow graph by solving equations to a fixed point.

    6 practice questions

GATE

Past GATE questions on Compiler Design by topic and year, the full papers, practice and the GATE syllabus.

36 questions, by topic and year

How many questions each topic had in the CS papers of each year. This shows what was asked, not what will be asked. We placed each question under a topic ourselves; the exam paper does not label topics.

Topic2018202020222023202420252026Total
Lexical analysis21·11128
Parsing112·43213
Syntax-directed translation·1112117
Runtime environments·······0
Intermediate code····11·2
Optimisation···11226

Solved papers

GATE 2023 comes from IIT Kanpur's own copy of the paper and its answer key, which numbers the CS questions Q.11 to Q.65. For 2024, 2025 and 2026 both sessions (CS1 and CS2) are included.

The GATE syllabus for Compiler Design, paper by paper

From the GATE 2027 syllabus PDF: CS Section 7, “Compiler Design”. Context-free grammars as languages, and push-down automata, are on the Theory of Computation page.

Show the GATE CS wording

Lexical analysis, parsing, syntax-directed translation. Runtime environments. Intermediate code generation. Local optimisation, Data flow analyses: constant propagation, liveness analysis, common sub expression elimination.

Download the full GATE 2027 syllabus PDFs

Preparing in Kolkata? See IAE Academy’s GATE CS coaching.

Other exams

5 questions on Compiler Design from ISRO's Scientist/Engineer written test (ISRO CS 2025, ISRO CS 2023), by topic. They are not counted in the GATE numbers on this page.

IF YOU WOULD RATHER TALK IT THROUGH

Get a preparation plan
built around your branch.

Book free counselling