Compiler Design

50 articles in this topic

Language Processing System in Compiler Design: Preprocessor to Loader with a Worked Trace

Follow one macro-containing C program through every language processor. The trace shows object-file relocation, a linker patch of +4, and the final value 7.

Updated 18 Sep 20265 min readCompiler Design

Three-Address Code (3AC): Quadruples, Triples and Indirect Triples with a Worked Example

Carry one expression through 3AC, quadruples, triples and indirect triples. See how every record is formed, valued and safely reordered.

Updated 16 Sep 20266 min readCompiler Design

LR(0) Parser Explained: Bottom-Up Parsing, Item Sets and a Worked Example

Build an LR(0) parser from one augmented grammar, then follow every state, table entry and stack operation until cdd$ is accepted.

Updated 15 Sep 20266 min readCompiler Design

Attributes and SDT Types in Compiler Design: S-Attributed, L-Attributed and a Worked Trace

See how attributes add meaning to a parse tree, how S-attributed and L-attributed definitions differ, and how one expression becomes both a value and postfix output.

Updated 13 Sep 20266 min read51 viewsCompiler Design

Liveness Analysis in Compiler Design: Data-Flow Equations and a Worked Example

A step-by-step guide to computing USE, DEF, IN and OUT on a looping control-flow graph, then tracing the result to one safe dead-store candidate.

Updated 12 Sep 20265 min readCompiler Design

SLR(1) Parser and Conflicts: LR(0) Items, FOLLOW Sets and a Full Parse

Build one SLR(1) parser from augmentation to acceptance. The same grammar exposes an LR(0) conflict, shows how FOLLOW removes it, and traces every move for aab$.

Updated 11 Sep 20266 min readCompiler Design

Top-Down Parsing in Compiler Design: Parser Basics and a Worked LL(1) Example

Follow one expression grammar from left-recursion removal to a complete LL(1) table. Then trace a valid token stream to acceptance and stop an invalid stream at its first error cell.

Updated 9 Sep 20266 min readCompiler Design

LL(1) Parser Table Explained: FIRST, FOLLOW and a Complete Worked Example

Build an LL(1) parsing table from one grammar, verify every cell, and follow the stack from S$ to acceptance. The same example connects FIRST, FOLLOW, conflicts and epsilon moves.

Updated 8 Sep 20265 min readCompiler Design

LALR(1) Parser Merging Explained: LR(1) States, Tables and Conflicts

Build ten canonical LR(1) states, merge them into seven LALR(1) states, construct the parsing table, and trace an accepted string without skipping steps.

Updated 6 Sep 20266 min readCompiler Design

First and Follow Sets Explained: Rules, Worked Example and LL(1) Checks

Learn a repeatable way to compute FIRST and FOLLOW sets, handle nullable suffixes, and use the results to test a grammar and fill its LL(1) parsing table.

Updated 5 Sep 20265 min read61 viewsCompiler Design

Symbol Table in Compiler Design: Errors, Passes and Worked Examples

Follow one scoped program from symbol-table insertion to type checking and error recovery, then see why a compiler phase is not the same thing as a pass.

Updated 3 Sep 20266 min readCompiler Design

Semantic Analysis and Syntax-Directed Translation: Worked Examples for GATE CS

Follow the compiler pipeline from symbol-table checks to attribute evaluation. Three worked examples trace an arithmetic expression, a declaration list, and postfix output.

Updated 1 Sep 20265 min readCompiler Design