Compiler Design

50 articles in this topic

Lexical Analysis and Tokens in Compiler Design: Worked Examples for GATE CS

See how a lexer turns source characters into tokens. The worked scan follows one complete line, builds symbol-table references, and exposes common traps.

Updated 31 Aug 20265 min readCompiler Design

CLR(1) Parser and Canonical LR(1) Items: Worked Closure, GOTO and Parse Table

Build a CLR(1) parser from one small grammar. Follow every closure, GOTO, table entry, and stack action until ccdd is accepted.

Updated 29 Aug 20265 min readCompiler Design

Compiler Design for GATE: A 6-Week Topic-by-Topic Study Plan

Follow a fixed eight-hour weekly clock through compiler phases, parsing, translation, runtime storage, optimisation and mixed revision.

Updated 29 Aug 20265 min readCompiler Design

Derivation and Recursion in CFG: Leftmost, Rightmost and Worked Examples

Follow three exact derivations to separate sentential forms from sentences, see how recursion behaves, and remove immediate left recursion without changing the language.

Updated 26 Aug 20265 min read79 viewsCompiler Design

Basic Blocks, Loops and Optimization Methods in Compiler Design: A Worked Example

Follow one three-address-code fragment from leader identification to a natural loop, then verify how invariant motion and strength reduction preserve its result.

Updated 24 Aug 20266 min readCompiler Design

Left Factoring in Compiler Design: Prefix Rules, Worked Grammars and Exam Traps

Learn how to find a useful common prefix, factor a grammar to a fixed point, preserve empty suffixes, and test what the result does and does not prove.

Updated 23 Aug 20265 min readCompiler Design

SSA and Control Flow in Compiler Design: Dominators, Phi Nodes and a Worked CFG

Build SSA as one connected process. This worked compiler-design example goes from a six-block CFG to dominators, phi placement, renaming and return value 3.

Updated 21 Aug 20266 min read61 viewsCompiler Design

Formal Grammar and Chomsky Hierarchy for GATE: Worked Derivations and Classification

Learn formal grammar from G=(V,T,P,S), derive aaabbb, classify Types 3 to 0, and prove why id+id*id is ambiguous before practising quick checks.

Updated 19 Aug 20266 min readCompiler Design

Top-Down Parsing in Compiler Design: Recursive Descent, LL(1), FIRST and FOLLOW with Worked Examples

Learn top-down parsing from grammar preparation to predictive parsing, with one expression grammar carried through every calculation and trace.

Updated 17 Aug 20267 min read94 viewsCompiler Design

Semantic Analysis and SDT in Compiler Design: Attributes, Worked Examples, and How GATE Tests It

Learn how semantic analysis validates meaning, how SDDs and SDTs evaluate attributes, and how to trace two common exam-style problems to their final answers.

Updated 15 Aug 20266 min readCompiler Design

Code Optimization in Compiler Design: Basic Blocks, Data Flow and Worked Examples

Learn how compiler optimizers use basic blocks, control-flow graphs and data-flow facts. Two checked traces cover loop strength reduction, liveness and safe dead-code removal.

Updated 13 Aug 20267 min readCompiler Design

Bottom-Up Parsing in Compiler Design: Shift-Reduce, LR Parsers, and Worked Examples

Learn bottom-up parsing as a mechanical stack process, then work through an expression trace and a complete LR(0) automaton construction.

Updated 11 Aug 20266 min readCompiler Design